Reputation: 309
I am relatively new to Laravel so I don't understand well all its features.
My routes:
Route::get('/', ['as' => 'index', 'uses' => 'PageController@index']);
Route::get('/contact', ['as' => 'contact', 'uses' => 'PageController@contact']);
Route::get('/cart', ['as' => 'cart', 'uses' => 'PageController@cart']);
Route::get('/checkout', ['as' => 'checkout', 'uses' => 'PageController@checkout']);
now the question is how to redirect from html
using blade templates
to the named route:
I tried:
<li><a href="{{ route('index') }}">HOME</a></li>
but it redirects to /index
instead of /
.
What would be the correct solution for redirect using {{ route('XXXX') }}
?
Upvotes: 0
Views: 245
Reputation: 2588
You can do
<li><a href="{{ url('/') }}">HOME</a></li>
UPDATED
Run the following commands:
php artisan route:clear
php artisan cache:clear
Upvotes: 1