Answer the question
In order to leave comments, you need to log in
Laravel 5.7 DB::Select array argument?
Good afternoon everyone.
Whether prompt it is possible to make selection somehow if as argument an array.
$category = DB::table('sd_category')->where('user', Auth::user()->id)->get();
Then I tried to run through
foreach ($categorys as $category) {
$task = DB::table('tasks')->where('category', $category->name)->orderBy('id', 'desc' )->paginate(15);
}
But in $task I get only the result of the last passage of foreach.
How can this be bypassed? Please let me know if anyone has experienced something similar.
Answer the question
In order to leave comments, you need to log in
the loop writes to a variable and not to an array, why should it show not the last element?
Write it to an array, and then substitute it in whereIn.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question