1

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 ?

hmmmmm
  • 29
  • 3
  • Possible duplicate of [PHP: "Notice: Undefined variable" and "Notice: Undefined index"](http://stackoverflow.com/questions/4261133/php-notice-undefined-variable-and-notice-undefined-index) – Qirel Dec 17 '15 at 15:26

1 Answers1

3

It has to be auth() not $auth

auth() is a helper function for Auth class

Huzaib Shafi
  • 1,153
  • 9
  • 24