Updated Server 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:
parent
1b2f501744
commit
1c0a82d533
|
@ -47,7 +47,6 @@ class ServerController extends Controller
|
||||||
'ip2' => 'sometimes|nullable|ip',
|
'ip2' => 'sometimes|nullable|ip',
|
||||||
'ns1' => 'sometimes|nullable|string',
|
'ns1' => 'sometimes|nullable|string',
|
||||||
'ns2' => 'sometimes|nullable|string',
|
'ns2' => 'sometimes|nullable|string',
|
||||||
'service_type' => 'integer',
|
|
||||||
'server_type' => 'integer',
|
'server_type' => 'integer',
|
||||||
'ssh_port' => 'integer',
|
'ssh_port' => 'integer',
|
||||||
'bandwidth' => 'integer',
|
'bandwidth' => 'integer',
|
||||||
|
@ -133,7 +132,6 @@ class ServerController extends Controller
|
||||||
'ip2' => 'sometimes|nullable|ip',
|
'ip2' => 'sometimes|nullable|ip',
|
||||||
'ns1' => 'sometimes|nullable|string',
|
'ns1' => 'sometimes|nullable|string',
|
||||||
'ns2' => 'sometimes|nullable|string',
|
'ns2' => 'sometimes|nullable|string',
|
||||||
'service_type' => 'integer',
|
|
||||||
'server_type' => 'integer',
|
'server_type' => 'integer',
|
||||||
'ssh_port' => 'integer',
|
'ssh_port' => 'integer',
|
||||||
'bandwidth' => 'integer',
|
'bandwidth' => 'integer',
|
||||||
|
@ -176,26 +174,24 @@ class ServerController extends Controller
|
||||||
'show_public' => (isset($request->show_public)) ? 1 : 0
|
'show_public' => (isset($request->show_public)) ? 1 : 0
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$server_id = $request->server_id;
|
|
||||||
|
|
||||||
$pricing = new Pricing();
|
$pricing = new Pricing();
|
||||||
$pricing->updatePricing($server_id, $request->currency, $request->price, $request->payment_term, $request->next_due_date);
|
$pricing->updatePricing($server->id, $request->currency, $request->price, $request->payment_term, $request->next_due_date);
|
||||||
|
|
||||||
Labels::deleteLabelsAssignedTo($server_id);
|
Labels::deleteLabelsAssignedTo($server->id);
|
||||||
|
|
||||||
Labels::insertLabelsAssigned([$request->label1, $request->label2, $request->label3, $request->label4], $server_id);
|
Labels::insertLabelsAssigned([$request->label1, $request->label2, $request->label3, $request->label4], $server->id);
|
||||||
|
|
||||||
IPs::deleteIPsAssignedTo($server_id);
|
IPs::deleteIPsAssignedTo($server->id);
|
||||||
|
|
||||||
for ($i = 1; $i <= 8; $i++) {//Max of 8 ips
|
for ($i = 1; $i <= 8; $i++) {//Max of 8 ips
|
||||||
$obj = 'ip' . $i;
|
$obj = 'ip' . $i;
|
||||||
if (isset($request->$obj) && !is_null($request->$obj)) {
|
if (isset($request->$obj) && !is_null($request->$obj)) {
|
||||||
IPs::insertIP($server_id, $request->$obj);
|
IPs::insertIP($server->id, $request->$obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Server::serverRelatedCacheForget();
|
Server::serverRelatedCacheForget();
|
||||||
Server::serverSpecificCacheForget($server_id);
|
Server::serverSpecificCacheForget($server->id);
|
||||||
|
|
||||||
return redirect()->route('servers.index')
|
return redirect()->route('servers.index')
|
||||||
->with('success', 'Server Updated Successfully.');
|
->with('success', 'Server Updated Successfully.');
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
@csrf
|
@csrf
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12 col-lg-6 mb-4">
|
<div class="col-12 col-lg-6 mb-4">
|
||||||
<input type="hidden" value="1" name="service_type">
|
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<div class="input-group-prepend"><span class="input-group-text">Hostname</span></div>
|
<div class="input-group-prepend"><span class="input-group-text">Hostname</span></div>
|
||||||
<input type="text"
|
<input type="text"
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
@method('PUT')
|
@method('PUT')
|
||||||
<div class="row mt-3">
|
<div class="row mt-3">
|
||||||
<div class="col-12 col-lg-6 mb-4">
|
<div class="col-12 col-lg-6 mb-4">
|
||||||
<input type="hidden" value="{{$server_data->id}}" name="server_id">
|
|
||||||
<x-text-input title="Hostname" name="hostname" value="{{ $server_data->hostname }}"></x-text-input>
|
<x-text-input title="Hostname" name="hostname" value="{{ $server_data->hostname }}"></x-text-input>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 col-lg-3 mb-4">
|
<div class="col-12 col-lg-3 mb-4">
|
||||||
|
|
Loading…
Reference in New Issue
Block a user