From 5a8542429595507a9aadb8824f5a3865e1830f85 Mon Sep 17 00:00:00 2001 From: snipe Date: Sun, 10 Mar 2024 16:33:04 +0000 Subject: [PATCH 1/3] Added created_at to license pivot Signed-off-by: snipe --- app/Models/User.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Models/User.php b/app/Models/User.php index f739ef8b0f..5312df2732 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -337,7 +337,7 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo */ public function licenses() { - return $this->belongsToMany(\App\Models\License::class, 'license_seats', 'assigned_to', 'license_id')->withPivot('id'); + return $this->belongsToMany(\App\Models\License::class, 'license_seats', 'assigned_to', 'license_id')->withPivot('id', 'created_at'); } /** From 3f5cc2507dc31f18592629de34604d7863b125a0 Mon Sep 17 00:00:00 2001 From: snipe Date: Sun, 10 Mar 2024 16:39:49 +0000 Subject: [PATCH 2/3] Used updated_at instead Signed-off-by: snipe --- app/Models/User.php | 2 +- resources/views/users/print.blade.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Models/User.php b/app/Models/User.php index 5312df2732..e535fa0fde 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -337,7 +337,7 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo */ public function licenses() { - return $this->belongsToMany(\App\Models\License::class, 'license_seats', 'assigned_to', 'license_id')->withPivot('id', 'created_at'); + return $this->belongsToMany(\App\Models\License::class, 'license_seats', 'assigned_to', 'license_id')->withPivot('id', 'created_at', 'updated_at'); } /** diff --git a/resources/views/users/print.blade.php b/resources/views/users/print.blade.php index 3be7923d88..cd82289863 100644 --- a/resources/views/users/print.blade.php +++ b/resources/views/users/print.blade.php @@ -151,7 +151,7 @@ {{ str_repeat('x', 15) }} @endcan - {{ $license->pivot->created_at }} + {{ $license->pivot->updated_at }} @php $lcounter++ From b049bb1d5c721ffa5a74fbd23c59be051d0b8d60 Mon Sep 17 00:00:00 2001 From: snipe Date: Mon, 11 Mar 2024 14:55:49 +0000 Subject: [PATCH 3/3] Check for null on select Signed-off-by: snipe --- resources/macros/macros.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/resources/macros/macros.php b/resources/macros/macros.php index c5c7824edc..72d4a404d4 100644 --- a/resources/macros/macros.php +++ b/resources/macros/macros.php @@ -37,7 +37,13 @@ Form::macro('countries', function ($name = 'country', $selected = null, $class = // Pull the autoglossonym array from the localizations translation file foreach (trans('localizations.countries') as $abbr => $country) { - $select .= ' '; + + // We have to handle it this way to handle deprecication warnings since you can't strtoupper on null + if ($abbr!='') { + $abbr = strtoupper($abbr); + } + + $select .= ' '; } $select .= '';