Firstly, I login 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 out Auth::check()
it returns TRUE which is fine so far I am logged now as user Y, the thing is that I do first login as an X user and then switch to another Y user but when I do call some other functoins it seems that the current user logged is still X, and I want to be Y the current user logged... This might have to do something with session or I dont know exactly how to do this thing, would be grateful if someone has any sample or have any idea how to achieve such things in Laravel 5.
No comments:
Post a Comment