summaryrefslogtreecommitdiff
path: root/app/Notifications/NewUserNotification.php
blob: d2a9b6f545633d3882f779a1b235d1c6176caef9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php

namespace App\Notifications;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
use App\Models\User;

class NewUserNotification extends Notification implements ShouldQueue
{
    use Queueable;

    protected User $newUser;

    public function __construct(User $newUser)
    {
        $this->newUser = $newUser;
    }

    public function via(object $notifiable): array
    {
        return ['mail'];
    }

    public function toMail(object $notifiable): MailMessage
    {
        return (new MailMessage)
            ->subject('New User Registered')
            ->line("A new account has been created.")
            ->line("Name: {$this->newUser->name}")
            ->line("Email: {$this->newUser->email}")
            ->line("Time: " . now()->format('Y-m-d H:i:s T'));
    }
}