From 512af90d31898131507759fdd2cc1cda438fa161 Mon Sep 17 00:00:00 2001 From: snipe Date: Mon, 8 Dec 2025 20:18:39 +0000 Subject: [PATCH] Re-removed non-asset models from kits These still do not work as expected. --- app/Models/Accessory.php | 13 ++ app/Models/PredefinedKit.php | 2 +- resources/views/kits/edit.blade.php | 216 ++++++++++++++-------------- 3 files changed, 122 insertions(+), 109 deletions(-) diff --git a/app/Models/Accessory.php b/app/Models/Accessory.php index 4a7f6f5f40..8edfac2115 100755 --- a/app/Models/Accessory.php +++ b/app/Models/Accessory.php @@ -246,6 +246,19 @@ class Accessory extends SnipeModel ->with('assignedTo'); } + /** + * Establishes the accessory -> users relationship + * + * @author [A. Gianotto] [] + * @since [v3.0] + * @return \Illuminate\Database\Eloquent\Relations\Relation + */ + public function users() + { + return $this->belongsToMany(\App\Models\AccessoryCheckout::class, 'accessories_checkout') + ->with('assignedTo'); + } + /** * Establishes the accessory -> admin user relationship * diff --git a/app/Models/PredefinedKit.php b/app/Models/PredefinedKit.php index 2d0c87066e..42dfdd9377 100644 --- a/app/Models/PredefinedKit.php +++ b/app/Models/PredefinedKit.php @@ -189,7 +189,7 @@ class PredefinedKit extends SnipeModel */ public function accessories() { - return $this->belongsToMany(\App\Models\Accessory::class, 'kits_accessories', 'kit_id', 'accessory_id')->withPivot('id', 'quantity'); + return $this->hasMany(\App\Models\Accessory::class, 'accessory_id', 'kit_id')->withPivot('id', 'quantity'); } /** diff --git a/resources/views/kits/edit.blade.php b/resources/views/kits/edit.blade.php index 032061c060..bfbad4d688 100644 --- a/resources/views/kits/edit.blade.php +++ b/resources/views/kits/edit.blade.php @@ -54,121 +54,121 @@ -
-
-
-
-
-
-

- {{ trans('general.licenses') }} -

-
+{{--
--}} +{{--
--}} +{{--
--}} +{{--
--}} +{{--
--}} +{{--
--}} +{{--

--}} +{{-- {{ trans('general.licenses') }}--}} +{{--

--}} +{{--
--}} - +{{--
--}} +{{--
--}} -
-
-
- -
-
-
-
-
-
+{{--
--}} +{{--
--}} +{{--
--}} +{{-- --}} +{{-- --}} +{{--
--}} +{{--
--}} +{{--
--}} +{{--
--}} +{{--
--}} -
-
-
-
-
-
-

- {{ trans('general.consumables') }} -

-
+{{--
--}} +{{--
--}} +{{--
--}} +{{--
--}} +{{--
--}} +{{--
--}} +{{--

--}} +{{-- {{ trans('general.consumables') }}--}} +{{--

--}} +{{--
--}} - -
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-

- {{ trans('general.accessories') }} -

-
+{{--
--}} +{{-- {{ trans('general.append') }}--}} +{{--
--}} +{{--
--}} +{{--
--}} +{{--
--}} +{{--
--}} +{{-- --}} +{{-- --}} +{{--
--}} +{{--
--}} +{{--
--}} +{{--
--}} +{{--
--}} +{{--
--}} +{{--
--}} +{{--
--}} +{{--
--}} +{{--
--}} +{{--
--}} +{{--

--}} +{{-- {{ trans('general.accessories') }}--}} +{{--

--}} +{{--
--}} - -
+{{--
--}} +{{-- {{ trans('general.append') }}--}} +{{--
--}} +{{--
--}} -
-
-
- -
-
-
-
-
-
+{{--
--}} +{{--
--}} +{{--
--}} +{{-- --}} +{{-- --}} +{{--
--}} +{{--
--}} +{{--
--}} +{{--
--}} +{{--
--}} @stop @section('moar_scripts')