lundi 6 janvier 2020

Laravel (hasManyThrough eloquent relation) - WhereHas with OrderBy working on localhost, not working on server

Laravel (hasManyThrough eloquent relation) - WhereHas with OrderBy working on localhost, not working on server. On localhost it working, it sorting (ordering) well, but on live server dont ordering well. On localhost is MARIADB on live server is MYSQL.

public function index(Product $product)

{
 $products = Product::with(['subcategory', 'subcategory.category'])->whereHas('subcategory', function ($query) {
     $query->whereHas('category', function ($query) {
     $query->orderBy('category_id', 'asc');
 }); })->get();

  return view('products.index', compact('products'));
}


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire