mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-24 05:04:07 -08:00
Added created_by to components
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
951f03094a
commit
6699995972
|
@ -98,6 +98,9 @@ class ComponentsController extends Controller
|
|||
case 'supplier':
|
||||
$components = $components->OrderSupplier($order);
|
||||
break;
|
||||
case 'created_by':
|
||||
$components = $components->OrderByCreatedBy($order);
|
||||
break;
|
||||
default:
|
||||
$components = $components->orderBy($column_sort, $order);
|
||||
break;
|
||||
|
|
|
@ -310,4 +310,9 @@ class Component extends SnipeModel
|
|||
{
|
||||
return $query->leftJoin('suppliers', 'components.supplier_id', '=', 'suppliers.id')->orderBy('suppliers.name', $order);
|
||||
}
|
||||
|
||||
public function scopeOrderByCreatedBy($query, $order)
|
||||
{
|
||||
return $query->leftJoin('users as admin_sort', 'components.created_by', '=', 'admin_sort.id')->select('components.*')->orderBy('admin_sort.first_name', $order)->orderBy('admin_sort.last_name', $order);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue