Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace App\Notifications;
- use Illuminate\Bus\Queueable;
- use Illuminate\Notifications\Notification;
- use Illuminate\Contracts\Queue\ShouldQueue;
- use Illuminate\Notifications\Messages\MailMessage;
- use App\Models\User;
- class UserCreated extends Notification
- {
- use Queueable;
- private $user;
- /**
- * Create a new notification instance.
- *
- * @return void
- */
- public function __construct(User $user)
- {
- $this->user = $user;
- $this->url = route("activation.verify", ['token' => $user->email_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 \Illuminate\Notifications\Messages\MailMessage
- */
- public function toMail($notifiable)
- {
- return (new MailMessage)
- ->greeting(sprintf("Hello %s", $this->user->first_name))
- ->line('Your account has been created.')
- ->action('Activate Account', $this->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 [
- //
- ];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement