DekGenius.com
PHP
laravel route namespace and prefix
Route::prefix('admin')->group(function () {
Route::get('/users', function () {
// Matches The "/admin/users" URL
});
});
laravel 8 routes namespace
Route::group(['namespace' => 'AppHttpControllers', 'prefix' => 'admin',
'as' => 'admin.', 'middleware' => ['auth:sanctum', 'verified']], function()
{
Route::get('/dashboard', ['DashboardController', 'index']);
});
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")
laravel route namespace and prefix
Route::name('admin.')->group(function () {
Route::get('/users', function () {
// Route assigned name "admin.users"...
})->name('users');
});
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 namespace and prefix
Route::get('/user/{name?}', function ($name = null) {
return $name;
});
Route::get('/user/{name?}', function ($name = 'John') {
return $name;
});
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 namespace and prefix
use AppModelsUser;
Route::get('/users/{user}', function (User $user) {
return $user->email;
});
© 2022 Copyright:
DekGenius.com