#1315 avantaj çelik harita alanının yapılması /advantage in steel map selection

This commit is contained in:
Diatrex 2020-05-04 16:34:54 +03:00
parent eaefe6b21f
commit e6e56da78e
2 changed files with 17 additions and 0 deletions

View File

@ -6,6 +6,7 @@ use Visiosoft\LocationModule\Country\CountryModel;
use Visiosoft\LocationModule\District\DistrictModel;
use Visiosoft\LocationModule\Neighborhood\NeighborhoodModel;
use Visiosoft\LocationModule\Village\VillageModel;
use Illuminate\Support\Str;
class AjaxController extends PublicController
{
@ -103,4 +104,19 @@ class AjaxController extends PublicController
return $this->village_model->whereIn('parent_neighborhood_id', $id)->orderBy('order', 'ASC')->get();
}
}
/**
* @return mixed
*/
public function getCity()
{
if ($this->request->name) {
$slug = Str::slug($this->request->name, '_');
if ($city = $this->city_model->newQuery()->where('slug', 'LIKE', $slug . '%')->first()) {
return ['success' => true, 'link' => route('visiosoft.module.advs::list') . '?city[]=' . $city->id];
} else {
return ['success' => false];
}
}
}
}

View File

@ -84,6 +84,7 @@ class LocationModuleServiceProvider extends AddonServiceProvider
'as' => 'location::getCities',
'uses' => 'Visiosoft\LocationModule\Http\Controller\AjaxController@getCities'
],
'ajax/get-city' => 'Visiosoft\LocationModule\Http\Controller\AjaxController@getCity',
'ajax/getDistricts' => [
'as' => 'location::getDistricts',
'uses' => 'Visiosoft\LocationModule\Http\Controller\AjaxController@getDistricts'