mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-31 16:37:27 -08:00
Added admin sort scope
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
8c3b50dbf2
commit
3a1fb615e7
|
@ -329,4 +329,14 @@ class AssetModel extends SnipeModel
|
|||
{
|
||||
return $query->leftJoin('custom_fieldsets', 'models.fieldset_id', '=', 'custom_fieldsets.id')->orderBy('custom_fieldsets.name', $order);
|
||||
}
|
||||
|
||||
/**
|
||||
* Query builder scope to order on created_by name
|
||||
*
|
||||
*/
|
||||
public function scopeOrderByCreatedByName($query, $order)
|
||||
{
|
||||
return $query->leftJoin('users as admin_sort', 'models.created_by', '=', 'admin_sort.id')->select('models.*')->orderBy('admin_sort.first_name', $order)->orderBy('admin_sort.last_name', $order);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue