*/ protected $fillable = [ 'email', 'password', ]; /** * The attributes that should be hidden for serialization. * * @var array */ protected $hidden = [ 'password', 'remember_token', 'roles' ]; /** * The attributes that should be cast. * * @var array */ protected $casts = [ 'email_verified_at' => 'datetime', ]; protected $guard_name = 'api'; public function doctor() { return $this->hasOne(Doctor::class); } public function role_data() { if (Auth::user()->hasRole('doctor')) { return $this->hasOne(Doctor::class); } elseif (Auth::user()->hasRole('patient')) { return $this->hasOne(Patient::class); } } // public function admin() { // } public function patient() { return $this->hasOne(Patient::class); } }