jeudi 3 janvier 2019

Three level eloquent relation orderBy in laravel 5

I have table quotes like this
Id , quote_title ,...

and quote_items:
Id , quote_id ,product_id

and products:
Id,product_name,product_category_id

I want to result of my query sort by product_category_id. this is my query:

$query = Quote::query();
$query->whereHas('quote_item' , function ($query) {
    $query->whereHas('product' , function ($query) {
        $query->orderBy('product_category_id');
    });
 });
$temp= $query->find($id);

result not has error but not order by



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire