Small fix for notifications checkout

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2024-09-20 19:11:52 +01:00
parent 7d858129d9
commit b68805cf83
2 changed files with 4 additions and 4 deletions

View file

@ -213,7 +213,7 @@ class ConsumablesController extends Controller
$consumable = Consumable::with(['consumableAssignments'=> function ($query) { $consumable = Consumable::with(['consumableAssignments'=> function ($query) {
$query->orderBy($query->getModel()->getTable().'.created_at', 'DESC'); $query->orderBy($query->getModel()->getTable().'.created_at', 'DESC');
}, },
'consumableAssignments.admin'=> function ($query) { 'consumableAssignments.adminuser'=> function ($query) {
}, },
'consumableAssignments.user'=> function ($query) { 'consumableAssignments.user'=> function ($query) {
}, },
@ -231,8 +231,8 @@ class ConsumablesController extends Controller
'name' => ($consumable_assignment->user) ? $consumable_assignment->user->present()->nameUrl() : 'Deleted User', 'name' => ($consumable_assignment->user) ? $consumable_assignment->user->present()->nameUrl() : 'Deleted User',
'created_at' => Helper::getFormattedDateObject($consumable_assignment->created_at, 'datetime'), 'created_at' => Helper::getFormattedDateObject($consumable_assignment->created_at, 'datetime'),
'note' => ($consumable_assignment->note) ? e($consumable_assignment->note) : null, 'note' => ($consumable_assignment->note) ? e($consumable_assignment->note) : null,
'admin' => ($consumable_assignment->admin) ? $consumable_assignment->admin->present()->nameUrl() : null, // legacy, so we don't change the shape of the response 'admin' => ($consumable_assignment->adminuser) ? $consumable_assignment->adminuser->present()->nameUrl() : null, // legacy, so we don't change the shape of the response
'created_by' => ($consumable_assignment->admin) ? $consumable_assignment->admin->present()->nameUrl() : null, 'created_by' => ($consumable_assignment->adminuser) ? $consumable_assignment->adminuser->present()->nameUrl() : null,
]; ];
} }

View file

@ -25,7 +25,7 @@ class AssetSeeder extends Seeder
$this->ensureLocationsSeeded(); $this->ensureLocationsSeeded();
$this->ensureSuppliersSeeded(); $this->ensureSuppliersSeeded();
$this->admin = User::where('permissions->superuser', '1')->first() ?? User::factory()->firstAdmin()->create(); $this->adminuser = User::where('permissions->superuser', '1')->first() ?? User::factory()->firstAdmin()->create();
$this->locationIds = Location::all()->pluck('id'); $this->locationIds = Location::all()->pluck('id');
$this->supplierIds = Supplier::all()->pluck('id'); $this->supplierIds = Supplier::all()->pluck('id');