I guess he uae am authentication by id
https://laravel.com/docs/5.6/authentication#other-authentication-methods
Or just login in passing a blank instance of user, if it's not to act as a specific user.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi All
I have noticed that Taylor has an "impersonating user" feature in Spark.
I am looking to do the same, also from the point of view, to support our users.
I have had a look at Laravel's docs, but I am a little lost on the best way to do it.
Any pointers would be great.
Thanks Chris
@ChrisPercival The way it works in Spark is, an impersonator value is put in the session with the current user’s ID. Spark then logs the requested user in using Auth::login(User::findOrFail($requestedId)).
To stop impersonating, Spark just pulls the impersonating user’s ID from the session and again does an Auth::login(User::findOrFail($impersonatorId)).
Please or to participate in this conversation.