DekGenius.com
PHP
laravel get current route name
Route::currentRouteName()
laravel get current route name
request()->route()->getName()
laravel get current route name
Route::getCurrentRoute()->getActionName();
laravel route name blade
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
laravel is route name
// Check if route is ***
Request::route()->named("YourRouteNameView")
check the route type in laravel
if($request->isMethod('post')){
//
}
naming the routes in laravel
Route::get('/', [ControllerName::class, 'index'])->name('homeRoute');
set route name laravel
Route::get('/novanoticia', 'HomeController@getNovaNoticia')->name('route_name');
Route::get('/novanoticia', ['as' => 'route_name', 'uses' => 'HomeController@getNovaNoticia']);
laravel route name routes
Route::get('user/profile', function () {
//
})->name('profile');
laravel get route
Route::get('foo', function () {
return 'Hello World';
});
laravel get route
Route::get('/user', 'UserController@index');
set route name laravel
Route::get('/novanoticia', 'HomeController@getNovaNoticia')->name('route_name');
what is route namespace in laravel
Route::namespace('Admin')->group(function () {
// Controllers Within The "AppHttpControllersAdmin" Namespace
});
laravel route name with parameters
Route::get('/user/{id}/profile', function ($id) {
//
})->name('profile');
$url = route('profile', ['id' => 1]);
© 2022 Copyright:
DekGenius.com