After using the Illuminate\Auth\Authenticatable
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 App\Models\User or App\Models\MyCustomAuthCapabaleModel)?
CodePudding user response:
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
CodePudding user response:
Auth::user();
returns all the information about the authenticated user