route middleware group laravel code example
Example 1: laravel route namespace and prefix
Route::prefix('admin')->group(function () {
Route::get('/users', function () {
});
});
Example 2: middleware command in laravel
php artisan make:middleware NameOfTheMiddleware
Example 3: laravel route
Route::get('user/profile', [UserProfileController::class, 'show'])->name('profile');
Example 4: middleware in laravel
<?php
namespace App\Http\Middleware;
use Closure;
class CheckType
{
public function handle($request, Closure $next)
{
return $next($request);
}
}