How to get the data of a logged-in user in Laravel Auth

SystemDown
Curious newcomer Level 2
Posts
5
Like
0
Since
2019
Automatically translated from Spanish
Author #1

Hello,

I'm building an application in laravel and I've used laravel's auth so that users can log in and authenticate.

Once the user logs in, how can I get the user's data?

Automatically translated from Spanish

1 replies

  1. Julio Rodríguez
    • SEO & GEO
    • CMS & No-code
    • Hosting & Servers
    • Web Development
    • Off-topic
    Regular Level 8
    Posts
    93
    Like
    0
    Since
    2026
    Automatically translated from Spanish

    The logged-in user's data is obtained with the User model.

    auth()->user()
    

    Now we simply have to iterate through that object to get the data we want, for example the name

    auth()->user()->name
    
    Automatically translated from Spanish

Sign in to take part in the forum.

This reply will be hidden. It is kept and can be restored.

Reason
or with your email