Files
exchange/app/Notifications/VerifyEmail.php
2018-06-22 11:29:22 +08:00

71 lines
1.7 KiB
PHP

<?php
namespace App\Notifications;
use App\User;
use App\VerifyUser;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
//use Illuminate\Auth\Notifications\VerifyEmail as Notification;
class VerifyEmail extends Notification
{
use Queueable;
/**
* Create a new notification instance.
*
* @return void
*/
protected $verifyUser;
public function __construct(VerifyUser $verifyUser)
{
$this->verifyUser = $verifyUser;
}
/**
* 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 \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable)
{
$verifyUser = $this->verifyUser;
$url = url('/user/verify/'.$verifyUser->token);
$greeting = sprintf('Greetings %s!', $notifiable->name);
return (new MailMessage)
->greeting($greeting)
->subject("Email Verification")
->line('Please verify your email to complete your registration with Exchange.')
->action('Verify Your Email', $url)
->line('Thank you for using our application!');
}
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public function toArray($notifiable)
{
return [
//
];
}
}