i have a simple user table
-id
-name
-email
-role
should i use the first or the second method ?!
the first method
1.
if(auth()->user()->role == 'admin')
{
// do something
}
else if (auth()->user()->role == 'supervised')
{
// do something
}
else{
//this is a simple user
}
and this is the second method
2.
$auth = auth()->user();
if($user->role == 'admin')
{
// do something
}
else if ($user->role == 'supervised')
{
// do something
}
else{
//this is a simple user
}
does this method auth()->user() call the database each time i call it !!!?