Error:
Route [events.destroy] not defined. (View: C:\xampp\htdocs\Event-Manager-Project\resources\views\events\admin.blade.php)
In my view, admin i have this about the delete:
<form action="{{ route('events.destroy', $event->id) }}" method="POST">
<a href="/admin/edit/{{$event->id}}" class="far fa-edit"></a>
@csrf
@method('DELETE')
<button type="submit" class="far fa-trash-alt" ></button>
</form>
In controller this:
public function destroy($id)
{
$event = Event::find($id);
$event->delete();
return redirect('/admin');
}
And using a route resource:
Route::resource('admin', 'App\Http\Controllers\EventController');
My Answer:
Rate this post
4 of 5 based on 7809 votesComments