I'm trying to manually log in a user within a Controller or a Route. This works during the scope of the page, but it doesn't persists.
Here is my code :
Route::get('check', function (){
if (Auth::loginUsingId(1)) { // User #1 is existing in the DB
return redirect()->intended('/check2');
}
});
Route::get('check2', function (){
dd(Auth::user());
});
And I got : null on my /check2 page
Can someone give me a quick hint?
PS: I tested the default Auth Laravel system and it works.
Thank you very much!