简体   繁体   English

Laravel 7 重定向登录授权

[英]Laravel 7 Redirect Login Authorization

I'm currently using template for my view using jQuery, HTML, and CSS.我目前正在使用 jQuery、HTML 和 CSS 的视图模板。

When I tried to use middleware to authenticate the user role before accessing routes,I stumble upon this error.当我尝试在访问路由之前使用中间件对用户角色进行身份验证时,我偶然发现了这个错误。

Error:错误:
错误

View [authorization.login] not found.查看 [authorization.login] 未找到。

Is it because I use a different name or custom login for my page?是因为我为我的页面使用了不同的名称或自定义登录吗? How can I change the link to my current login address?如何更改指向我当前登录地址的链接?

Here are my routes这是我的路线

Route::get('/user-register-page', 'LoginUserController@registerUserPage')->middleware(['auth','auth.admin']);

Route::post('/register-user', 'Auth\RegisterController@create')->name('register');

And here's my controller这是我的 controller

class LoginUserController extends Controller
{

    public function registerUserPage(){
        return view('user-register');
    }

    public function loginUserPage(){
        return view('user-login');
    }

    // public function registerNewUser(Request $request){
    //     dd('test');
    // }

    // public function loginUser(){


    // }


}   

In your resources folder inside views you will find a folder called auth , in case it is not there, create a folder called auth and drag in your file user-login and rename it to login .views中的resources文件夹中,您会找到一个名为auth的文件夹,如果它不存在,请创建一个名为auth的文件夹并拖入您的文件user-login并将其重命名为login

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM