Reputation: 1073
I use Laravel 5.2 and I am interested how to secure all controller if user is not authorized.
In this case user should be redirect to login page. I try to make this using routing.
I set this code above all routes:
Route::auth();
Upvotes: 0
Views: 105
Reputation: 136
You have to just wrap up all needed routes by middleware group.
Route::group(['middleware' => 'auth'], function () {
Route::get('path1');
Route::get('path2');
Route::get('path3');
etc....
});
Also you need to create middleware class and register it in kernel
Upvotes: 1
Reputation: 136
use middleware. It will help to filter and secure all routes
https://laravel.com/docs/5.2/middleware
Upvotes: 2