I've got a route defined as:
Route::get('/novanoticia', 'HomeController@getNovaNoticia');
When I run php artisan route:list
it shows nothing on the name column. How to add a name to the route in such a way that I can later call it just by its name like: href="{{ route('route_name', $routeparam) }}
?
Or will I have to redefine the route? Thanks in advance
Option 1
Route::get('/novanoticia', 'HomeController@getNovaNoticia')->name('route_name');
Option 2
Route::get('/novanoticia', ['as' => 'route_name', 'uses' => 'HomeController@getNovaNoticia']);
https://laravel.com/docs/5.3/routing#named-routes
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With