1, the use of Laravel auth verification
2. Change the model in configuration auth.php to Appmodelsadminuser::class (because it is the login authentication of the background user)
3, in the page with Ajax call Background login method, the main logic is as follows:
if (auth::attempt (' name ' = = $request->input (' name '), ' password ' = ' = $request->input (' password ')])) {
// 认证通过... dd(Auth::user()); }
I was able to see in the browser console the back of the DD login user information, but at this time to another page to print Auth::user (), then null, where is the problem?
Reply content:
1, the use of Laravel auth verification
2. Change the model in configuration auth.php to Appmodelsadminuser::class (because it is the login authentication of the background user)
3, in the page with Ajax call Background login method, the main logic is as follows:
if (auth::attempt (' name ' = = $request->input (' name '), ' password ' = ' = $request->input (' password ')])) {
// 认证通过... dd(Auth::user()); }
I was able to see in the browser console the back of the DD login user information, but at this time to another page to print Auth::user (), then null, where is the problem?