You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since Auth::user() returns back a user model object, it will be nice if you create probably a function in your User Model class (or as it is named). See a sample.
In your case, it might not be User Model, depending on what you named your provider/ multi-auth.
namespaceApp;
useIlluminate\Database\Eloquent\Model;
useIlluminate\Notifications\Notifiable;
class User extends Model
{
... // other model fields and method herepublicfunctionisTeacher() {
$teacher = App\Teacher::where('email', $this->email)->first();
returnis_null($teacher);
}
}
This is definitely a very good answer! And totally works. It is a very nice way of simplifying the stuff on the controllers' code. Maybe it will be worth adding this method when generating model on php artisan multi-auth:install ?
Anyway, thank you very much :)
I'm trying to do something like:
and so on.
Is there a way we can accomplish this?
The text was updated successfully, but these errors were encountered: