I am new to laravel. I am working on a laravel 5 application with different types of users. I need information about what type of user is currently registered in different sections of my views:
I'm currently doing something like below on various controller methods and with a user object, I can determine what type of user it is in my opinion:
In the controller:
public function someMethod(){
$user = Auth::user();
return view('applications.show', compact('user'));
}
In view:
if($user->is_manager)
else if($user->is_admin)
Since I need information about the type of user in different views, I called Auth::user()in several places, and I'm starting to think that this adds some load to the database. Is it better to store a custom type in a session variable and what data should I store in my session?