kobylike2's avatar

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?

0 likes
0 replies

Please or to participate in this conversation.