Updated Shared controller and create & edit views

Updated Shared controller and create & edit views

Uses the resource id now
No passing hidden input id
Uses alert component for response
This commit is contained in:
cp6 2022-10-31 16:00:00 +11:00
parent 724b7536a7
commit d79c571505
3 changed files with 8 additions and 13 deletions

View File

@ -147,18 +147,18 @@ class SharedController extends Controller
]); ]);
$pricing = new Pricing(); $pricing = new Pricing();
$pricing->updatePricing($request->id, $request->currency, $request->price, $request->payment_term, $request->next_due_date); $pricing->updatePricing($shared->id, $request->currency, $request->price, $request->payment_term, $request->next_due_date);
Labels::deleteLabelsAssignedTo($request->id); Labels::deleteLabelsAssignedTo($shared->id);
Labels::insertLabelsAssigned([$request->label1, $request->label2, $request->label3, $request->label4], $request->id); Labels::insertLabelsAssigned([$request->label1, $request->label2, $request->label3, $request->label4], $shared->id);
Cache::forget("labels_for_service.{$request->id}"); Cache::forget("labels_for_service.{$shared->id}");
IPs::deleteIPsAssignedTo($request->id); IPs::deleteIPsAssignedTo($shared->id);
if (isset($request->dedicated_ip)) { if (isset($request->dedicated_ip)) {
IPs::insertIP($request->id, $request->dedicated_ip); IPs::insertIP($shared->id, $request->dedicated_ip);
} }
Cache::forget("shared_hosting.{$request->id}"); Cache::forget("shared_hosting.{$shared->id}");
Cache::forget('all_shared'); Cache::forget('all_shared');
Home::homePageCacheForget(); Home::homePageCacheForget();

View File

@ -20,7 +20,6 @@
<x-text-input title="Domain" name="domain" value="{{$shared->main_domain}}"></x-text-input> <x-text-input title="Domain" name="domain" value="{{$shared->main_domain}}"></x-text-input>
</div> </div>
<div class="col-12 col-lg-3 mb-4"> <div class="col-12 col-lg-3 mb-4">
<input type="hidden" name="id" value="{{$shared->id}}">
<div class="input-group"> <div class="input-group">
<div class="input-group-prepend"><span class="input-group-text">Type</span></div> <div class="input-group-prepend"><span class="input-group-text">Type</span></div>
<select class="form-control" id="shared_type" name="shared_type"> <select class="form-control" id="shared_type" name="shared_type">

View File

@ -12,11 +12,7 @@
<div class="card shadow mt-3"> <div class="card shadow mt-3">
<div class="card-body"> <div class="card-body">
<a href="{{ route('shared.create') }}" class="btn btn-primary mb-3">Add shared hosting</a> <a href="{{ route('shared.create') }}" class="btn btn-primary mb-3">Add shared hosting</a>
@if ($message = Session::get('success')) <x-response-alerts></x-response-alerts>
<div class="alert alert-success" role="alert">
<p class="my-1">{{ $message }}</p>
</div>
@endif
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-bordered"> <table class="table table-bordered">
<thead class="table-light"> <thead class="table-light">