I have a variable $filter_value
which as below data:
where("document_language_id",2)->where("manufacturer_id",1)->where("manual_type_id",1)
I want to use that value in below query to get data:
$jobs = Job::$filter_values->paginate(10);
The problem is that I get error while doing that. So, my question is that how can I use that variable in that query?
CodePudding user response:
That's impossible. Instead, you can use:
$filter_value = Job::where("document_language_id",2)->where("manufacturer_id",1)->where("manual_type_id",1);
$jobs = $filter_value->paginate(10);
CodePudding user response:
You should use query method of Eloquent to get data with conditionally.
$jobsQuery = Job::query();
$jobsQuery->where("document_language_id",2)->where("manufacturer_id",1)->where("manual_type_id",1);
$jobsQuery->paginate(10);