Nome da rota atual do Laravel
$route = Route::current();
$name = Route::currentRouteName();
$action = Route::currentRouteAction();
Cooperative Crab
$route = Route::current();
$name = Route::currentRouteName();
$action = Route::currentRouteAction();
How to use routes in web.php :
Route::get('/', function () { return view('home'); })->name('home');
How to use routes in your page.blade.php :
<a href="{{ url("/") }}">home</a>
// or
<a href="{{ route('home') }}">home</a>
// Like the post if you found it usefull and help other devs to find the good answer
// Check if route is ***
Request::route()->named("YourRouteNameView")
// This has been the best way for me to test routes with parameters
@if(url()->current() == route('named-route', 'parameter')
// do stuff
@endif
Route::get('/novanoticia', 'HomeController@getNovaNoticia')->name('route_name');
Route::get('/novanoticia', ['as' => 'route_name', 'uses' => 'HomeController@getNovaNoticia']);