Closed AlexMcowkin closed 6 years ago
Good question. The best way to do this is to use the tools that Laravel itself provides. Once you have published the config files for this package you can edit the sentry config file to tell the Sentry package to use your user model App\User
instead of the default Sentry user. (Make sure that your user model is extending the Sentry user class.) From there you can do almost anything:
$user = \App\User::find(1);
echo $user->first_name;
echo $user->second_name;
If you fetch the user object in your controller and pass it to your custom views you should be good to go. You can see examples of how that works in the controllers in this package.
thank you
how to get current logged in user id?
This package is a wrapper for the Cartalyst\Sentry package; all of the methods there are available to you in your application.
To determine if a user is currently logged in: Sentry::check()
If that method returns true, you can get the user object via Sentry::getUser()
Running getUser()
if there is no active session available will throw an exception.
yes. I did it already. but thank you. when I will have more free time I will write instruction for russians =)
How can we get User data like id, email and etc?
I need use it in my views!
sorry for the questions but I dont understand how