Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confide::user() return by itself. #503

Closed
chaiha opened this issue Jan 24, 2015 · 1 comment
Closed

Confide::user() return by itself. #503

chaiha opened this issue Jan 24, 2015 · 1 comment

Comments

@chaiha
Copy link

chaiha commented Jan 24, 2015

I found the problem that when I log in to website by using Confide once and use the website for a while, Laravel show error that "Trying to get property of non-object" at the Confide::user(). How can I fix this problem? Thank you.
confide

@Zizaco
Copy link
Owner

Zizaco commented Jan 31, 2015

Something like this should help.

$user = Confide::user();

if ($user) {
    $username = $user->username;
} else {
    $username = 'Guest';
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants