When i search by city name which is available in my database table it will show the result but when i search by unknown city which is not available in my database table it says -No query results for model [App\City]. i am sharing you the code and screenshot see error screenshot actually i want to redirect to 401 page if the city is not found in my database table
Here is my route
Route::get('teacher-jobs-by-city/{city}','TeacherJobsController@by_location');
Here is my function
public function by_location($location_id='') {
$data= array();
$location = City::where('slug',$location_id)->where('status','1')->firstOrFail();
$items= Subject::orderBy('id','asc')->get();
$data['location']=$location;
//$subjects = [''=>'Select Subject'] + Subject::lists('subject_title','id')->toArray();
//$city = [''=>'Select City'] + City::lists('name','id')->toArray();
$active_class ='Select Subject to see job Openings';
return view('frontend.teacherjobs.by_location',compact('active_class','data','items'));
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire