Closed dhofstedt closed 3 years ago
I've just started using this package on a new product (Laravel 8) and am seeing the same thing.
On update, I have the update method to
return redirect($idea->path())->with('success-message', 'Idea updated');
The path()
method is:
public function path()
{
return url('ideas', [$this->slug]);
}
But, like you, it is landing at 'ideas/{id}' and resulting in a 404.
Update: I actually had the id
being referenced in the form action. Changed it to
<form method="POST" action="{{ route('ideas.update', $idea) }}">
and it is working properly now.
@dhofstedt Make sure you have Route Model Binding set up correctly as per the docs. I believe you want to use /post/{post}
as the route, not /post/{id}
.
@kerrinhardy That works as well.
After submitting a resource update form on a sluggable model, a 404 not found error occurs due to a redirect to the specific resource being updated. Rather than redirecting to posts.index as specified in the update() method, it is redirecting to (or getting stuck at?) posts/{id}.
There are no issues with posts/{slug} or posts/{slug}/edit, only this issue on update(). There is normal update behavior before making the model sluggable and again after reverting to its pre-sluggable state.
The route:list looked fine, but I ran route:clear anyways and still the same thing happens.