I
I
it-spec972016-05-22 19:39:44
Laravel
it-spec97, 2016-05-22 19:39:44

Why laravel scolds that Route is not found, although it is?

Registered REST routers for my products

Route::get('product', 'ProductControl[email protected]');
Route::post('product', '[email protected]');
Route::get('product/create', '[email protected]');
Route::patch('product/{product}', '[email protected]');
Route::get('product/{product}', '[email protected]');
Route::put('product/{product}', '[email protected]');
Route::get('product/{product}/edit', '[email protected]');
Route::delete('product/{product}', '[email protected]');

I created a link on the main page and put the "product" route with the "index" method into it.
<a class="navbar-brand" href="{{ route('product.index') }}">Спортивные товары</a>

Everything should work according to the idea, but when following this route, localhost: 8000 / product
gives such an error, supposedly the router is not defined.
Route [product.index] not defined. (View: D:\OpenServer\domains\sportgoods\resources\views\index.blade.php)

Where did you make a mistake?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
JhaoDa, 2016-05-22
@it-spec97

Because it is necessary to give names to routes. Laravel does this automatically if you declare REST routes as in the documentation .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question