Skip to content

Instantly share code, notes, and snippets.

@cursosdesarrolloweb
Created July 20, 2021 17:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cursosdesarrolloweb/dc5b8484ea6b89e3baf312d11dd13ed3 to your computer and use it in GitHub Desktop.
Save cursosdesarrolloweb/dc5b8484ea6b89e3baf312d11dd13ed3 to your computer and use it in GitHub Desktop.
<?php
namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
class ResetPassword extends Notification
{
use Queueable;
private string $token;
/**
* Create a new notification instance.
*
* @param string $token
*/
public function __construct(string $token)
{
$this->token = $token;
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
return ['mail'];
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return MailMessage
*/
public function toMail( $notifiable ) {
$link = route("password.reset", ["token" => $this->token]);
return ( new MailMessage )
->greeting("Hola,")
->subject( 'Restablecer contraseña')
->line( "Recibes este correo electrónico porque hemos recibido una solicitud de restablecimiento de contraseña para tu cuenta.")
->action( 'Restablecer ahora', $link)
->line( 'Si no has solicitado el restablecimiento de tu contraseña puedes olvidar este mensaje.')
->line( 'Este enlace caducará en 60 minutos.');
}
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public function toArray($notifiable)
{
return [
//
];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment