Reputation: 1143
I'm using laravel API handler and I was wondering on how to send a request to order by a column from 'with' table
Here is my backend code
$query = Product::query();
$query->company();
$query->with('category'); $result=ApiHandler::parseMultiple($query);
return $result->getResponse();
and the request-url
Upvotes: 1
Views: 157
Reputation: 1660
$query = Product::getModel()
->newQuery()
->select('products.*','categories.*')
->join('categories','product.category_id,'=','categories.id')
->orderBy('category.sort_order');
Something like that should do.
Upvotes: 1