I am authenticating users with the normal auth eloquent driver.
I want to also check if the User (after logged in) is also an instance of another model.
I found out that he has an array with all of model_2's data but checking if that is empty
sounds like a workaround.
How should I tackle this?
Model 1: Auth::user
Model 2: Teacher
if(Auth::check) {// check for logged in
if(Auth::user()->is_teacher() ? // -- how can I do this?
Maybe this can work for you:
$email = Auth::user()->email;
$match = false;
if (Teacher::where('email','=',$email)->first() != NULL) {
$match = true;
}
return $match;