I'm trying to make a delete button in Laravel, but it redirects me to a white page. this is the html code for the delete button (it's an icon):
<a class="icon" href="{{ route('capteurs.destroy', $capteur->id)}}" data-balloon="Supprimer" data-balloon-pos="right">
<i class="fe fe-trash-2" ></i>
</a>
destroy
function in the controller class:
public function destroy($id)
{
$capteur = Capteur::find($id);
$capteur->delete();
return redirect('/capteurs')->with('success', 'Capteur Supprimé');
}
I'm supposed to be redirected to /capteurs
which is this page:
Instead i get redirected here, and the element i wanna delete is still there:
Edit: Routes for capteurs
Route::resource('capteurs', 'CapteurController');