*/ public static $cacheRelations = [ 'userPassword', 'sites', ]; /** * Get the password for authentication. * Retrieves the hashed password from the related user_passwords table. * * @return string */ #[\Override] public function getAuthPassword(): string { return $this->userPassword()->value('password') ?? ''; } /** * Send the password reset notification to the user. * * @param string $token * @return void */ // phpstan-ignore-next-line // phpcs:ignore #[\Override] public function sendPasswordResetNotification($token): void { $url = sprintf( "%s?email=%s", url(route('back.reset-password', ['token' => $token], false)), urlencode($this->getEmailForPasswordReset()) ); Mail::send(new LinkResetPasswordMail($url, $this)); } // * RELATIONSHIPS. /** * Get the user's associated password. * * @return \Illuminate\Database\Eloquent\Relations\HasOne<\App\Models\UserPassword,\App\Models\User> */ public function userPassword(): \Illuminate\Database\Eloquent\Relations\HasOne { return $this->hasOne(UserPassword::class); } /** * Get sites associated to the brand. * * @return \Illuminate\Database\Eloquent\Relations\MorphToMany<\App\Models\Site> */ public function sites(): \Illuminate\Database\Eloquent\Relations\MorphToMany { return $this->morphToMany( Site::class, 'sitable', 'sitables', 'sitable_id', 'site_id', )->withPivot('created_at'); } }