token = $token; } /** * Get the notification's delivery channels. * * @return array */ public function via($notifiable) { return ['mail']; } /** * Get the mail representation of the notification. */ public function toMail($notifiable) { if (static::$toMailCallback) { return call_user_func(static::$toMailCallback, $notifiable, $this->token); } return $this->buildMailMessage($this->resetUrl($notifiable)); } protected function buildMailMessage($url) { return (new MailMessage) ->line('Anda mendapat email ini karena kita menerima permintaan untuk ganti password akun anda.') ->action('Ganti Password', $url) ->line('Link ganti password ini akan expired setelah 60 menit.'); } protected function resetUrl($notifiable) { if (static::$createUrlCallback) { return call_user_func(static::$createUrlCallback, $notifiable, $this->token); } $email = $notifiable->getEmailForPasswordReset(); return url("http://localhost:5173/ganti-password/$this->token?email=$email"); } /** * Set a callback that should be used when creating the reset password button URL. * * @param \Closure(mixed, string): string $callback * @return void */ public static function createUrlUsing($callback) { static::$createUrlCallback = $callback; } /** * Set a callback that should be used when building the notification mail message. * * @param \Closure(mixed, string): (\Illuminate\Notifications\Messages\MailMessage|\Illuminate\Contracts\Mail\Mailable) $callback * @return void */ public static function toMailUsing($callback) { static::$toMailCallback = $callback; } }