<?php
// To get both the jobs :
$allJobs = $jobs->where('status', 'active')->paginate(15);
// To get al basic jobs
$allBasicJobs = $jobs->where('status', 'active')->where('type', 'basic')->paginate(15);
// To get all premium jobs
$allBasicJobs = $jobs->where('status', 'active')->where('type', 'op2')->paginate(15);
// To search title in basic jobs but get all premier jobs
$filteredBasicJobsAllPremiumJobs = $jobs->where('status', 'active')
->where('type', 'op2')
->orWhere(function($q) use($request){
return $q->where('type', 'basic')
->where('title', 'like', '%' . $request->q . '%');
})
->paginate(15);
// To search title in permium jobs but get all basic jobs
$filteredPremiumJobsAllBasicJobs = $jobs->where('status', 'active')
->where('type', 'basic')
->orWhere(function($q) use($request){
return $q->where('type', 'op2')
->where('title', 'like', '%' . $request->q . '%');
})
->paginate(15);
// To search title in both basic and premium jobs
$filteredJobs = $jobs->where('status', 'active')
->where('title', 'like', '%' . $request->q . '%')
->paginate(15);