Answer the question
In order to leave comments, you need to log in
How to fix error in Laravel route?
Good day.
I am writing a small blog on Laravel and literally stalled on the frontend route.
It is necessary that the address contains both the slug of the category and the entry
itself, the route itself is like this
Route::resource('blog', 'PostController')
->only('index')
->names('blog');
Route::get('{category}/{slug}', '[email protected]')
->name('blog.show');
public function show( $category, $slug)
{
dd(__METHOD__);
}
</code
в вьюхе я вывожу все посты @forelse? вобщем как обычно
и все работает test.loc/blog
но как только прописываю маршрут на полную новость
<code lang="php">
<a class="btn btn-outline-primary" href="{{route('blog.show',['category' => $item->category->slug, 'slug'=> $item->slug ] )}}" role="button">Читать далее»</a>
</code>
сразу лезет ошибка о том что не переданны данные в маршрут
Missing required parameters for [Route: blog.show] [URI: {category}/{slug}]. (View: G:\OSPanel\domains\test.loc\resources\views\site\front\blog\main.blade.php)
Что- то в ступор влез и не могу понять, вроде все просто но...!
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question