mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 13:44:06 -08:00
Added maintenance scope for ordering by supplier
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
a57a6486e7
commit
07bc2fd742
|
@ -162,6 +162,20 @@ class AssetMaintenance extends Model implements ICompanyableChild
|
||||||
* -----------------------------------------------
|
* -----------------------------------------------
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Query builder scope to order on a supplier
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Database\Query\Builder $query Query builder instance
|
||||||
|
* @param string $order Order
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Database\Query\Builder Modified query builder
|
||||||
|
*/
|
||||||
|
public function scopeOrderBySupplier($query, $order)
|
||||||
|
{
|
||||||
|
return $query->leftJoin('suppliers as suppliers_maintenances', 'asset_maintenances.supplier_id', '=', 'suppliers_maintenances.id')
|
||||||
|
->orderBy('suppliers_maintenances.name', $order);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Query builder scope to order on admin user
|
* Query builder scope to order on admin user
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue