简体   繁体   中英

Laravel 7 Redirect Login Authorization

I'm currently using template for my view using jQuery, HTML, and 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.

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

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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