Description

The user model represents a user that is registered on the site. An instance of a user model contains basic profile information about the user.

Attributes

A user model will have the following attributes set when successfully returned. You can access these directly using the -> operator.


id - The auto-incrementing identifier for this user's entry in the database.

user_id - The user's Discord (snowflake) User ID.

username - The user's Discord username.

discriminator - The user's Discord discriminator (the 4-digit number at the end of their username).

avatar - The user's Discord avatar. Returns an animated avatar if the user has an animated avatar.

Functions


getDisplayName()

Returns the user's username and discriminator in the form shown on Discord.



//...

Hello, {{ Auth::user()->getDisplayName() }}!
// Displays "Hello, username#0000!"

            

Collections


guilds

Returns a collection of guilds that the user belongs to.



//...

@foreach (Auth::user()->guilds as $guild)
    {{ $guild->name }}
@endforeach