Fix Delete

This commit is contained in:
SahrulGnwn 2022-08-11 16:59:04 +07:00
parent e9348eca52
commit 7ad56dad8d
3 changed files with 20 additions and 16 deletions

View file

@ -204,7 +204,7 @@ class ServerController extends Controller
} }
/** Remove the specified resource from storage. */ /** Remove the specified resource from storage. */
public function delete(Server $server) public function destroy(Server $server)
{ {
try { try {
$server->delete(); $server->delete();

View file

@ -21,7 +21,7 @@
</div> </div>
</section> </section>
<!-- END CONTENT HEADER --> <!-- END CONTENT HEADER -->
<!-- MAIN CONTENT --> <!-- MAIN CONTENT -->
<section class="content"> <section class="content">
@ -104,7 +104,7 @@
</div> </div>
<div class="col-4 text-end"> <div class="col-4 text-end">
<div class="icon icon-shape bg-gradient-warning shadow-warning text-center rounded-circle"> <div class="icon icon-shape bg-gradient-warning shadow-warning text-center rounded-circle">
<i class='bx bxs-hdd' style="color: white;"></i> <i class='bx bxs-hdd' style="color: white;"></i>
</div> </div>
</div> </div>
</div> </div>
@ -244,20 +244,21 @@
<br> <br>
<br> <br>
<form action="{{ route('servers.upgrade', ['server' => $server->id]) }}" method="POST"> <form action="{{ route('servers.upgrade', ['server' => $server->id]) }}" method="POST">
@csrf @csrf
<select name="product_upgrade" id="product_upgrade" class="form-input2 form-control"> <select name="product_upgrade" id="product_upgrade" class="form-input2 form-control">
<option value="">Select the product</option> <option value="">Select the product</option>
@foreach($products as $product) @foreach($products as $product)
@if(in_array($server->egg, $product->eggs) && $product->id != $server->product->id) @if(in_array($server->egg, $product->eggs) && $product->id != $server->product->id)
<option value="{{ $product->id }}">{{ $product->name }} [ {{ CREDITS_DISPLAY_NAME }} {{ $product->price }} ]</option> <option value="{{ $product->id }}">{{ $product->name }} [ {{ CREDITS_DISPLAY_NAME }} {{ $product->price }} ]</option>
@endif @endif
@endforeach @endforeach
</select> </select>
<br> Once the Upgrade button is pressed, we will automatically deduct the amount for the first hour according to the new product from your credits. <br> <br> Once the Upgrade button is pressed, we will automatically deduct the amount for the first hour according to the new product from your credits. <br>
</div> </div>
<div class="modal-footer card-body"> <div class="modal-footer card-body">
<button type="submit" class="btn btn-primary" style="width: 100%"><strong>Upgrade</strong></button> <button type="submit" class="btn btn-primary" style="width: 100%"><strong>Upgrade</strong></button>
</div> </div>
</form>
</div> </div>
</div> </div>
</div> </div>
@ -282,7 +283,11 @@
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button> <button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
<a href="{{ route('servers.delete', ['server' => $server->id]) }}" type="button" class="btn btn-danger">Remove</a> <form class="d-inline" method="post" action="{{ route('servers.destroy', ['server' => $server->id]) }}">
@csrf
@method('DELETE')
<button data-toggle="popover" data-trigger="hover" data-placement="top" class="btn btn-danger mr-1">Delete</button>
</form>
</div> </div>
</div> </div>
</div> </div>
@ -300,4 +305,4 @@
<!-- END CONTENT --> <!-- END CONTENT -->
@endsection @endsection

View file

@ -64,7 +64,6 @@ Route::middleware(['auth', 'checkSuspended'])->group(function () {
Route::resource('notifications', NotificationController::class); Route::resource('notifications', NotificationController::class);
Route::resource('servers', ServerController::class); Route::resource('servers', ServerController::class);
Route::post('servers/{server}/upgrade', [ServerController::class,'upgrade'])->name('servers.upgrade'); Route::post('servers/{server}/upgrade', [ServerController::class,'upgrade'])->name('servers.upgrade');
Route::get('servers/{server}/delete', [ServerController::class,'delete'])->name('servers.delete');
Route::resource('profile', ProfileController::class); Route::resource('profile', ProfileController::class);
Route::resource('store', StoreController::class); Route::resource('store', StoreController::class);