67 lines
1.7 KiB
PHP
Executable File
67 lines
1.7 KiB
PHP
Executable File
<?php
|
|
|
|
namespace App\Notifications;
|
|
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Illuminate\Notifications\Messages\MailMessage;
|
|
use Illuminate\Notifications\Notification;
|
|
|
|
class licencias extends Notification implements ShouldQueue
|
|
{
|
|
use Queueable;
|
|
public $notificacion;
|
|
/**
|
|
* Create a new notification instance.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function __construct($notificacion)
|
|
{
|
|
$this-> notificacion = $notificacion;
|
|
}
|
|
|
|
/**
|
|
* Get the notification's delivery channels.
|
|
*
|
|
* @param mixed $notifiable
|
|
* @return array
|
|
*/
|
|
public function via($notifiable)
|
|
{
|
|
return ['database','mail'];
|
|
}
|
|
|
|
/**
|
|
* Get the mail representation of the notification.
|
|
*
|
|
* @param mixed $notifiable
|
|
* @return \Illuminate\Notifications\Messages\MailMessage
|
|
*/
|
|
public function toMail($notifiable)
|
|
{
|
|
return (new MailMessage)
|
|
->subject('Alerta cuentas de '.$this->notificacion['servicio'] )
|
|
->greeting('Hola,')
|
|
->line('De '.$this->notificacion['servicio'].' quedan '. $this->notificacion['cantidad'] .' '.$this->notificacion['tipo'].' disponibles.')
|
|
->action('Añadir cuentas', url('/planes'))
|
|
->line('Gracias por usar SirPremium!');
|
|
}
|
|
|
|
/**
|
|
* Get the array representation of the notification.
|
|
*
|
|
* @param mixed $notifiable
|
|
* @return array
|
|
*/
|
|
public function toArray($notifiable)
|
|
{
|
|
return [
|
|
'servicio' => $this->notificacion['servicio'],
|
|
'cantidad' => $this->notificacion['cantidad'],
|
|
'tipo' => $this->notificacion['tipo'],
|
|
|
|
];
|
|
}
|
|
}
|