Closed Mozzarella-dev closed 2 years ago
Why are you not passing the post to the route by either ID or route model binding? It doesn't know how to find it in the route.
Like so:
Route::delete('/posts/{post}', [App\Http\Controllers\PostController::class, 'destroy'])->name('posts.destroy');
Following a tutorial i wasn't binding the model to the route, now it works properly, thanks for the head up!
I've got a simple datatable with a delete button in each row, the cell of the button looks like this:
This is my route:
Finally the
destroy
method inside the controller looks like this:After clicking the button i get dumped the class of the Post model and not the post itself. (Looking into the attributes of the dump nothing shows up)
There's a way i can hotfix that?