问题
I have successfully created a logging and registration system!
I get to the part where I need to do the sign out option.
My course I bought at Udemy is a bit old so I don't have a file called filters.php
I searched on the internet to find a file called filters.php and found one post saying Middleware was used instead of filter.php
How to create a Sign out option now using Middleware?
Web.php
Route::group(array('before' => 'auth'), function()){
}
回答1:
You don't need to create the sign out option, which it already included in Laravel Authentication.
You can get more information about how to setup it at the link below:-
https://laravel.com/docs/5.7/authentication
Otherwise, Laravel Authentication almost cover all authentication functions such as login, reset password and logout.
When you complete the setup. It will generate the middleware and controller for the Authentication feature. You just need to add some code at your route file.
Auth::routes(); //This line help to declare the route used by Laravel Authentication
Route::group(['middleware'=>['admin']],function(){
//Declare Your Route that only allowed access by the logged in user here
});
来源:https://stackoverflow.com/questions/60805647/laravel-7-filters