I have a problem in a query when I use pagination with select in laravel but I found some laravel elequoent code but problem is that also not work ... anyone who can help me to solve this problem, Thanks
public function categoryall($urlid){
//old query
// $procat = DB::select('select * from products where category_id in
// (select id from categories where parent_id = ?)', [$urlid]);
// new
$procat = Product::whereIn('category_id', function($query){
$query->select('id')
->from(with(new Category)->getTable())
->where('parent_id', [$urlid]);
})->paginate(5);
return view('products.category')->with(compact('procat'));
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire