Jan 11, 2025
0
Level 1
Error 404 when i use slug. im using livewire
When i use slug like this it display error 404
Route::get('/post/{post:slug}', PostDetailsComponent::class)->name('post.details');
Read more
public function getRouteKeyName()
{
return 'slug'; // Ensures Laravel resolves the {post} parameter using the slug
}
when I use $post->id it works but not with slug. Any reason and how to solve it?
Please or to participate in this conversation.