hmmmmm
hmmmmm

Reputation: 29

Undefined variable: auth

I am trying to get the value stored in Auth::user()

I created a new Controller with the name of User_Controller and in index method I am writing below code.

echo '<pre>';
print_r($auth->user());
echo '</pre>';
die();

It says

Undefined variable: auth

Am I doing something wrong ?

Upvotes: 1

Views: 2373

Answers (1)

Huzaib Shafi
Huzaib Shafi

Reputation: 1138

It has to be auth() not $auth

auth() is a helper function for Auth class

Upvotes: 3

Related Questions