Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How {{ Auth::user()->name }} is able to print username in blade file?

I have been working in default authentication features in laravel..I found in one blade file Auth::user()->name is able to display name stored in user table..But what i want to know is how it is able display name in blade with an eloquent call.

like image 643
siva sandeep Avatar asked Nov 19 '25 10:11

siva sandeep


1 Answers

You can use it like this.

auth()->user()->some_column

Check your user table in your database and use the appropriate column name.

You can use it in blade file like this. {{ auth()->user()->some_column }}

If you're going to use this in a conditional statement like IF, you can use it like this.

@if(auth()->user()->some_column)

like image 77
Gayan Kalhara Avatar answered Nov 21 '25 02:11

Gayan Kalhara