Laravel 7 filters

最后都变了- 提交于 2021-01-29 13:13:20

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!