From 997eddfed1bda9d6559b9d7604f0cde1ddc7a7aa Mon Sep 17 00:00:00 2001 From: spencerrlongg Date: Thu, 4 Apr 2024 18:23:03 -0500 Subject: [PATCH] cleanup + notes for monday --- app/Http/Requests/StoreAssetRequest.php | 2 -- app/Http/Requests/Traits/MayContainCustomFields.php | 5 ++++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/Http/Requests/StoreAssetRequest.php b/app/Http/Requests/StoreAssetRequest.php index 587116de42..b00baf90f7 100644 --- a/app/Http/Requests/StoreAssetRequest.php +++ b/app/Http/Requests/StoreAssetRequest.php @@ -38,8 +38,6 @@ class StoreAssetRequest extends ImageUploadRequest 'company_id' => $idForCurrentUser, 'assigned_to' => $assigned_to ?? null, ]); - - //$this->after(); } /** diff --git a/app/Http/Requests/Traits/MayContainCustomFields.php b/app/Http/Requests/Traits/MayContainCustomFields.php index 5a3299b365..a506412fe7 100644 --- a/app/Http/Requests/Traits/MayContainCustomFields.php +++ b/app/Http/Requests/Traits/MayContainCustomFields.php @@ -15,6 +15,7 @@ trait MayContainCustomFields }); if (count($request_fields) > 0) { if ($this->method() == 'POST') { + // refactor to eager load the fields??? $request_fields->diff(AssetModel::find($this->model_id)->fieldset->fields->pluck('db_column')) ->each(function ($request_field_name) use ($request_fields, $validator) { // i could probably add some more conditions here to determine whether or not the column exists but just not on this asset model @@ -23,9 +24,11 @@ trait MayContainCustomFields }); } elseif ($this->method() == 'PUT' || $this->method() == 'PATCH') { // need to know about other pr before I can go down this route + // it should be more or less the same, just have to get the asset model differently + // ($this->asset should work if the other PR is accepted) + return; } } - }); } }