First, I log in as user X, and I have a function like:
public function loginAs($userId) { Auth::loginUsingId($userId); // now use Y user return response()->json(['logged' => Auth::check(), 'user' => Auth::user()]); }
and when I try to print Auth::check() , it returns TRUE , which so far I have registered as user Y, the fact is that I first log in as user X and then switch to another user Y, but when I I call some other functions, it seems that the current user is still registered X, and I want to be Y of the current user registered ... This may have to do something with the session or I donβt know exactly how to do it, it would be grateful if someone had a sample or you have an idea how achieve such things in Laravel 5.
Artan source share