Browse Source

🔒 Sécurise la suppression

master
Clement Desmidt 2 years ago
parent
commit
cc27b189b1
2 changed files with 8 additions and 3 deletions
  1. +7
    -2
      resources/views/list.blade.php
  2. +1
    -1
      routes/web.php

+ 7
- 2
resources/views/list.blade.php View File

@@ -5,7 +5,7 @@
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="panel panel-default">
<div class="panel-heading">Dashboard</div>
<div class="panel-heading">Dashboard @if($type !== 'all') − <a href="<?php echo route('home'); ?>">Revenir à la liste</a>@endif</div>

<div class="panel-body">
@if (session('status'))
@@ -36,7 +36,12 @@
</td>
<td>
<a href="<?php echo route('deals.view', ['type' => $type, 'id' => $deal->getId()]); ?>">Voir</a>
<a href="<?php echo route('deals.delete', ['type' => $type, 'id' => $deal->getId()]); ?>">Supprimer</a>
@if( $type === 'backup')
<form method="POST" action="<?php echo route('deals.delete', ['type' => $type, 'id' => $deal->getId()]); ?>">
{{ csrf_field() }}
<button type="submit">Supprimer</button>
</form>
@endif
</td>
</tr>
@endforeach</tbody>


+ 1
- 1
routes/web.php View File

@@ -21,6 +21,6 @@ Route::get('/deals/list/{type}', 'HomeController@list')->name('deals.list');

Route::get('/deals/view/{type}/{id}', 'HomeController@view')->name('deals.view');

Route::get('/deals/delete/{type}/{id}', 'HomeController@delete')->name('deals.delete');
Route::post('/deals/delete/{type}/{id}', 'HomeController@delete')->name('deals.delete');

Route::match(['GET', 'POST'], '/deals/update/{type}/{id}', 'HomeController@update')->name('deals.update');

Loading…
Cancel
Save