app/Http/Controllers/JobManagerController.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)
    {
        $jobs = Job::searchJob($request);
        if(!empty($jobs)) {
            $jobs = $jobs->orderBy('created_at', 'desc')->paginate(20);
        } else {
            $jobs = Job::orderBy('created_at', 'desc')->paginate(20);
        }
        if($request->isXmlHttpRequest()) {
            return response(
                view('layouts.admin.job_and_relate.job.table', ['jobs' => $jobs, 'count' => count($jobs)]),
                200,
                ['Content-Type', 'application/json']
            );
        }
        $jobTypes = JobType::where('status', config('global.statusActive'))->get();
        $provinces = Province::select(['id', 'name'])->where('status', config('global.statusActive'))->get();
        return view('layouts.admin.job_and_relate.job.index')
            ->with('jobs', $jobs)
            ->with('count', count($jobs))
            ->with('jobTypes', $jobTypes)
            ->with('provinces', $provinces);
    }
public function index ( Request $ request ) { $ jobs = Job :: searchJob ( $ request ) ; if ( ! empty ( $ jobs ) ) { $ jobs = $ jobs -> orderBy ( 'created_at' , 'desc' ) -> paginate ( 20 ) ; } else { $ jobs = Job :: orderBy ( 'created_at' , 'desc' ) -> paginate ( 20 ) ; } if ( $ request -> isXmlHttpRequest ( ) ) { return response ( view ( 'layouts.admin.job_and_relate.job.table' , [ 'jobs' => $ jobs , 'count' => count ( $ jobs ) ] ) , 200 , [ 'Content-Type' , 'application/json' ] ) ; } $ jobTypes = JobType :: where ( 'status' , config ( 'global.statusActive' ) ) -> get ( ) ; $ provinces = Province :: select ( [ 'id' , 'name' ] ) -> where ( 'status' , config ( 'global.statusActive' ) ) -> get ( ) ; return view ( 'layouts.admin.job_and_relate.job.index' ) -> with ( 'jobs' , $ jobs ) -> with ( 'count' , count ( $ jobs ) ) -> with ( 'jobTypes' , $ jobTypes ) -> with ( 'provinces' , $ provinces ) ; }
Display a listing of the resource.
Display a listing of the resource .