From 9d33f8ad6e4c20e96021958631f6cec3e13df4fe Mon Sep 17 00:00:00 2001 From: cp6 Date: Mon, 31 Oct 2022 16:00:43 +1100 Subject: [PATCH] Updated Reseller controller and create & edit views Uses the resource id now No passing hidden input id Uses alert component for response --- app/Http/Controllers/ResellerController.php | 18 ++++++++++-------- resources/views/reseller/edit.blade.php | 1 - resources/views/reseller/index.blade.php | 6 +----- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/app/Http/Controllers/ResellerController.php b/app/Http/Controllers/ResellerController.php index 14a330c..6b25fa7 100644 --- a/app/Http/Controllers/ResellerController.php +++ b/app/Http/Controllers/ResellerController.php @@ -136,6 +136,7 @@ class ResellerController extends Controller 'reseller_type' => $request->reseller_type, 'provider_id' => $request->provider_id, 'location_id' => $request->location_id, + 'accounts' => $request->accounts, 'disk' => $request->disk, 'disk_type' => 'GB', 'disk_as_gb' => $request->disk, @@ -150,19 +151,20 @@ class ResellerController extends Controller ]); $pricing = new Pricing(); - $pricing->updatePricing($request->id, $request->currency, $request->price, $request->payment_term, $request->next_due_date); + $pricing->updatePricing($reseller->id, $request->currency, $request->price, $request->payment_term, $request->next_due_date); - Labels::deleteLabelsAssignedTo($request->id); - Labels::insertLabelsAssigned([$request->label1, $request->label2, $request->label3, $request->label4], $request->id); + Labels::deleteLabelsAssignedTo($reseller->id); + Labels::insertLabelsAssigned([$request->label1, $request->label2, $request->label3, $request->label4], $reseller->id); - IPs::deleteIPsAssignedTo($request->id); + IPs::deleteIPsAssignedTo($reseller->id); - if (isset($request->dedicated_ip)) { - IPs::insertIP($request->id, $request->dedicated_ip); + if (!is_null($request->dedicated_ip)) { + IPs::insertIP($reseller->id, $request->dedicated_ip); } - Cache::forget("reseller_hosting.{$request->id}"); - Cache::forget("labels_for_service.{$request->id}"); + Cache::forget("all_reseller"); + Cache::forget("reseller_hosting.{$reseller->id}"); + Cache::forget("labels_for_service.{$reseller->id}"); Home::homePageCacheForget(); diff --git a/resources/views/reseller/edit.blade.php b/resources/views/reseller/edit.blade.php index 0d2ea95..4410f30 100644 --- a/resources/views/reseller/edit.blade.php +++ b/resources/views/reseller/edit.blade.php @@ -20,7 +20,6 @@
-
Type