Skip to content

Commit

Permalink
Merge pull request #15653 from snipe/15651_admin_user_on_maintenances
Browse files Browse the repository at this point in the history
Fixed #15651 - admin user now displaying on maintenances page
  • Loading branch information
snipe authored Oct 11, 2024
2 parents 8aa298f + b054017 commit 12bda8f
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 8 deletions.
2 changes: 1 addition & 1 deletion app/Http/Transformers/AssetMaintenancesTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function transformAssetMaintenance(AssetMaintenance $assetmaintenance)
'completion_date' => Helper::getFormattedDateObject($assetmaintenance->completion_date, 'date'),
'user_id' => ($assetmaintenance->adminuser) ? [
'id' => $assetmaintenance->adminuser->id,
'name'=> e($assetmaintenance->admin->getFullNameAttribute())
'name'=> e($assetmaintenance->adminuser->present()->fullName())
] : null, // legacy to not change the shape of the API
'created_by' => ($assetmaintenance->adminuser) ? [
'id' => (int) $assetmaintenance->adminuser->id,
Expand Down
2 changes: 1 addition & 1 deletion app/Models/AssetMaintenance.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public function asset()
*/
public function adminuser()
{
return $this->belongsTo(\App\Models\User::class, 'user_id')
return $this->belongsTo(\App\Models\User::class, 'created_by')
->withTrashed();
}

Expand Down
6 changes: 0 additions & 6 deletions app/Presenters/AssetMaintenancesPresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,6 @@ public static function dataTableLayout()
'sortable' => true,
'title' => trans('admin/asset_maintenances/form.cost'),
'class' => 'text-right',
], [
'field' => 'user_id',
'searchable' => true,
'sortable' => true,
'title' => trans('general.admin'),
'formatter' => 'usersLinkObjFormatter',
], [
'field' => 'created_by',
'searchable' => false,
Expand Down

0 comments on commit 12bda8f

Please sign in to comment.