*/ protected $fillable = [ 'restaurant_id', 'first_name', 'last_name', 'username', 'email', 'phone', 'password', 'otp_code', 'isVerified', 'email_verified_at', 'address', 'avatar', 'role_id', 'user_type', 'facebook', 'twitter', 'linkedin', 'google_plus', 'nid', 'platform', 'device_info', 'last_active_time', 'status', 'bio', 'fcm_token', 'qr_code', 'department_id', 'designation_id', 'salary_type_id', 'address', 'gender', 'date_of_birth', 'joining_date', 'basic_salary', 'created_by', 'deleted_at', ]; /** * The attributes that should be hidden for serialization. * * @var list */ protected $hidden = [ 'password', 'remember_token', ]; /** * Get the attributes that should be cast. * * @return array */ protected function casts(): array { return [ 'email_verified_at' => 'datetime', 'password' => 'hashed', ]; } public function role(): HasOne { return $this->hasOne(Role::class, 'id', 'role_id'); } public function restaurant(): HasOne { return $this->hasOne(Restaurant::class, 'id', 'restaurant_id')->select('id', 'name', 'address', 'domain'); } public function rider(): HasOne { return $this->hasOne(Rider::class, 'user_id', 'id'); } public function customer(): HasOne { return $this->hasOne(User::class); } protected static function newFactory(): UserFactory { return UserFactory::new(); } // Example: single FCM token public function routeNotificationForFcm(): mixed { return $this->fcm_token; } // Or for multiple devices public function getDeviceTokens(): mixed { return $this->deviceTokens()->pluck('token')->toArray(); } }