From d494afcf01a1683a2a712215020ecad1c3e14c45 Mon Sep 17 00:00:00 2001 From: Ivan Nieto Vivanco Date: Tue, 21 Feb 2023 21:24:19 -0600 Subject: [PATCH] Add order by clause, to ensure assets and accessories are in order in the report --- app/Models/User.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Models/User.php b/app/Models/User.php index 34c0af6b2e..606b83b973 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -285,7 +285,7 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo */ public function assets() { - return $this->morphMany(\App\Models\Asset::class, 'assigned', 'assigned_type', 'assigned_to')->withTrashed(); + return $this->morphMany(\App\Models\Asset::class, 'assigned', 'assigned_type', 'assigned_to')->withTrashed()->orderBy('id'); } /** @@ -313,7 +313,7 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo public function accessories() { return $this->belongsToMany(\App\Models\Accessory::class, 'accessories_users', 'assigned_to', 'accessory_id') - ->withPivot('id', 'created_at', 'note')->withTrashed(); + ->withPivot('id', 'created_at', 'note')->withTrashed()->orderBy('accessory_id'); } /**