Menu
About LCS
Controller
It manges delgation between routes, views and model
Not locking every method in controller under auth middleware
Sometimes it is not required to put every controller method under auth middleware. We can achieve the result by following...
Topic:
Middleware
3 years ago
Disabling verify csrf token middleware for specific route
It needs to be disabled in app\Http\Middleware\VerifyCsrfToken.php like following snippetprotected $except = [ // '/admin/gift_photos/upload' ]; Another thing, to exclude...
Topic:
Middleware
3 years ago
Applying auth middleware to all laravel routes
Route::group(['middleware' => ['auth']], function () { Route::get('/users', [UsersController::class,'admin'])->name('users.admin'); Route::post('/users/search', [UsersController::class,'inactive'])->name('users.admin.search'); Route::get('/users/inactive', [UsersController::class,'inactive'])->name('users.admin.inactive'); }); In route group we can set auth...
Topic:
Middleware
3 years ago
Setting up custom middleware such as isAdmin
It can be done in following steps so that only admin role users can access those specified routes.Step 1: Defining...
Topic:
Middleware
3 years ago