</div> <div class="three fields"> <div class="field"> <label>จังหวัด</label> <div id="map_dropdown_province" class="ui fluid selection dropdown"> <input type="hidden" name="project[province_id]" value="{{$project->province_id}}"> <i class="dropdown icon"></i> @if($project->province_id) <div class="text">{{$project->province->province_name}}</div> @else <div class="default text">เลือกจังหวัด</div> @endif <div class="menu"> <?php $provinces = \App\Models\Thailand\Province::all(); ?> @foreach($provinces as $province) <div class="item {{ $project->province_id == $province->id ? "active" : "" }}" data-value="{{$province->PROVINCE_ID}}"> {{$province->PROVINCE_NAME}} </div> @endforeach </div> </div> </div> <div class="field"> <label>อำเภอ</label> <div id="map_dropdown_amphur" class="ui fluid selection dropdown"> <input type="hidden" name="project[amphur_id]" value="{{$project->amphur_id}}"> <i class="dropdown icon"></i>
}); }); Route::group(['prefix' => 'api', 'middleware' => ['api']], function () { Route::get('project', function () { $projects = Project::whereHas('status', function ($q) { $q->where('key', '=', 'published'); })->get(); return $projects; }); Route::get('project/{id}', function ($id) { $project = Project::with(['photos', 'youtubes', 'users'])->find($id); return $project; }); Route::get('/researcher/dropdown/{keyword?}', "Backends\\UserController@apiGetResearcherForDropdown"); Route::get("/province", function () { return \App\Models\Thailand\Province::all(); }); Route::get("/province/{provinceId}/amphur", function ($provinceId) { return \App\Models\Thailand\Amphur::where("PROVINCE_ID", "=", $provinceId)->get(); }); Route::get("/province/{provinceId}/amphur/{amphurId}/district", function ($provinceId, $amphurId) { return \App\Models\Thailand\District::where("PROVINCE_ID", "=", $provinceId)->where("AMPHUR_ID", "=", "{$amphurId}")->get(); }); }); Route::group(['middleware' => ['web']], function () { Route::get('/', "FrontendController@index"); Route::get('/post/{id}', "FrontendController@getPost"); }); Route::get('/amphur/{id}/{name}', function ($id, $name) { $amphur = \App\Models\Thailand\Amphur::find($id); $query = Project::query();