mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-24 21:24:13 -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':
|
case 'supplier':
|
||||||
$accessories = $accessories->OrderSupplier($order);
|
$accessories = $accessories->OrderSupplier($order);
|
||||||
break;
|
break;
|
||||||
|
case 'created_by':
|
||||||
|
$accessories = $accessories->OrderByCreatedByName($order);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
$accessories = $accessories->orderBy($column_sort, $order);
|
$accessories = $accessories->orderBy($column_sort, $order);
|
||||||
break;
|
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
|
* Query builder scope to order on company
|
||||||
*
|
*
|
||||||
|
|
|
@ -127,13 +127,6 @@ class AccessoryPresenter extends Presenter
|
||||||
'visible' => false,
|
'visible' => false,
|
||||||
'title' => trans('general.notes'),
|
'title' => trans('general.notes'),
|
||||||
'formatter' => 'notesFormatter'
|
'formatter' => 'notesFormatter'
|
||||||
], [
|
|
||||||
'field' => 'change',
|
|
||||||
'searchable' => false,
|
|
||||||
'sortable' => false,
|
|
||||||
'visible' => true,
|
|
||||||
'title' => trans('general.change'),
|
|
||||||
'formatter' => 'accessoriesInOutFormatter',
|
|
||||||
], [
|
], [
|
||||||
'field' => 'created_by',
|
'field' => 'created_by',
|
||||||
'searchable' => false,
|
'searchable' => false,
|
||||||
|
@ -157,6 +150,13 @@ class AccessoryPresenter extends Presenter
|
||||||
'title' => trans('general.updated_at'),
|
'title' => trans('general.updated_at'),
|
||||||
'visible' => false,
|
'visible' => false,
|
||||||
'formatter' => 'dateDisplayFormatter',
|
'formatter' => 'dateDisplayFormatter',
|
||||||
|
], [
|
||||||
|
'field' => 'change',
|
||||||
|
'searchable' => false,
|
||||||
|
'sortable' => false,
|
||||||
|
'visible' => true,
|
||||||
|
'title' => trans('general.change'),
|
||||||
|
'formatter' => 'accessoriesInOutFormatter',
|
||||||
], [
|
], [
|
||||||
'field' => 'actions',
|
'field' => 'actions',
|
||||||
'searchable' => false,
|
'searchable' => false,
|
||||||
|
|
Loading…
Reference in a new issue