mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-24 05:04:07 -08:00
Added order by created_by to accessories
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
a77a7065d7
commit
c93229179b
|
@ -112,6 +112,9 @@ class AccessoriesController extends Controller
|
|||
case 'supplier':
|
||||
$accessories = $accessories->OrderSupplier($order);
|
||||
break;
|
||||
case 'created_by':
|
||||
$accessories = $accessories->OrderByCreatedByName($order);
|
||||
break;
|
||||
default:
|
||||
$accessories = $accessories->orderBy($column_sort, $order);
|
||||
break;
|
||||
|
|
|
@ -422,6 +422,16 @@ class Accessory extends SnipeModel
|
|||
* -----------------------------------------------
|
||||
**/
|
||||
|
||||
|
||||
/**
|
||||
* Query builder scope to order on created_by name
|
||||
*
|
||||
*/
|
||||
public function scopeOrderByCreatedByName($query, $order)
|
||||
{
|
||||
return $query->leftJoin('users as admin_sort', 'accessories.created_by', '=', 'admin_sort.id')->select('accessories.*')->orderBy('admin_sort.first_name', $order)->orderBy('admin_sort.last_name', $order);
|
||||
}
|
||||
|
||||
/**
|
||||
* Query builder scope to order on company
|
||||
*
|
||||
|
|
|
@ -127,13 +127,6 @@ class AccessoryPresenter extends Presenter
|
|||
'visible' => false,
|
||||
'title' => trans('general.notes'),
|
||||
'formatter' => 'notesFormatter'
|
||||
], [
|
||||
'field' => 'change',
|
||||
'searchable' => false,
|
||||
'sortable' => false,
|
||||
'visible' => true,
|
||||
'title' => trans('general.change'),
|
||||
'formatter' => 'accessoriesInOutFormatter',
|
||||
], [
|
||||
'field' => 'created_by',
|
||||
'searchable' => false,
|
||||
|
@ -157,7 +150,14 @@ class AccessoryPresenter extends Presenter
|
|||
'title' => trans('general.updated_at'),
|
||||
'visible' => false,
|
||||
'formatter' => 'dateDisplayFormatter',
|
||||
],[
|
||||
], [
|
||||
'field' => 'change',
|
||||
'searchable' => false,
|
||||
'sortable' => false,
|
||||
'visible' => true,
|
||||
'title' => trans('general.change'),
|
||||
'formatter' => 'accessoriesInOutFormatter',
|
||||
], [
|
||||
'field' => 'actions',
|
||||
'searchable' => false,
|
||||
'sortable' => false,
|
||||
|
|
Loading…
Reference in a new issue