*/ protected $fillable = [ 'name', 'email', 'avatar', 'password', ]; /** * The attributes that should be hidden for serialization. * * @var array */ protected $hidden = [ 'id', 'password', 'remember_token', 'email_verified_at', ]; /** * Get the attributes that should be cast. * * @return array */ protected function casts(): array { return [ 'email_verified_at' => 'datetime', 'password' => 'hashed', 'has_password' => 'boolean', ]; } public function userProviders(): HasMany { return $this->hasMany(UserProvider::class); } public function mustVerifyEmail(): bool { return !$this->hasVerifiedEmail(); } public function createDeviceToken(string $device, string $ip, bool $remember = false): string { $sanctumToken = $this->createToken( $device, ['*'], $remember ? now()->addMonth() : now()->addDay() ); $sanctumToken->accessToken->ip = $ip; $sanctumToken->accessToken->save(); return $sanctumToken->plainTextToken; } }