skip to Main Content

After using the IlluminateAuthAuthenticatable trait on a model, I can now do Auth::id() in places in my app (when the current auth-ed thing is that particular model).

Is there a way to get the class / type of the auth-ed model?

Perhaps something like Auth::model() which might return the model’s class name (such as AppModelsUser or AppModelsMyCustomAuthCapabaleModel)?

2

Answers


  1. Auth::user(); returns all the information about the authenticated user

    Login or Signup to reply.
  2. Auth::user(); returns the model of the logged in user.

    If you ever wish to change the User model, you can change it in config/auth.php at the key providers.users.model

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search