app/Http/Controllers/DistrictController.php
/**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
Display a listing of the resource.
@return \Illuminate\Http\Response
Display a listing of the resource . @return \ Illuminate \ Http \ Response
public function index(Request $request)
    {
        if(!empty($request->province) && !empty($province = Province::find($request->province))) {
            $districts = District::where('province_id',$province->id)->paginate(10);
            if($request->isXmlHttpRequest()) {
                return response(
                    view('layouts.admin.job_and_relate.district.table', ['districts' => $districts]),
                    200,
                    ['Content-Type', 'application/json']
                );
            }
            return view('layouts.admin.job_and_relate.district.index')->with('districts', $districts)->with('province', $province);
        }
        return redirect()->route('404');
    }
public function index ( Request $ request ) { if ( ! empty ( $ request -> province ) && ! empty ( $ province = Province :: find ( $ request -> province ) ) ) { $ districts = District :: where ( 'province_id' , $ province -> id ) -> paginate ( 10 ) ; if ( $ request -> isXmlHttpRequest ( ) ) { return response ( view ( 'layouts.admin.job_and_relate.district.table' , [ 'districts' => $ districts ] ) , 200 , [ 'Content-Type' , 'application/json' ] ) ; } return view ( 'layouts.admin.job_and_relate.district.index' ) -> with ( 'districts' , $ districts ) -> with ( 'province' , $ province ) ; } return redirect ( ) -> route ( '404' ) ; }
Display a listing of the resource.
Display a listing of the resource .