1 | <?php
|
---|
2 |
|
---|
3 | namespace App\Notifications;
|
---|
4 |
|
---|
5 | use App\Models\Company;
|
---|
6 | use App\Models\User;
|
---|
7 | use App\Services\Hashid;
|
---|
8 | use Illuminate\Bus\Queueable;
|
---|
9 | use Illuminate\Contracts\Queue\ShouldQueue;
|
---|
10 | use Illuminate\Notifications\Messages\MailMessage;
|
---|
11 | use Illuminate\Notifications\Notification;
|
---|
12 |
|
---|
13 | class VerifyUser extends Notification implements ShouldQueue
|
---|
14 | {
|
---|
15 | use Queueable;
|
---|
16 |
|
---|
17 | protected $user;
|
---|
18 |
|
---|
19 | /**
|
---|
20 | * Create a new notification instance.
|
---|
21 | *
|
---|
22 | * @return void
|
---|
23 | */
|
---|
24 | public function __construct(User $user)
|
---|
25 | {
|
---|
26 | $this->user = $user;
|
---|
27 | }
|
---|
28 |
|
---|
29 | /**
|
---|
30 | * Get the notification's delivery channels.
|
---|
31 | *
|
---|
32 | * @param mixed $notifiable
|
---|
33 | * @return array
|
---|
34 | */
|
---|
35 | public function via($notifiable)
|
---|
36 | {
|
---|
37 | return ['mail'];
|
---|
38 | }
|
---|
39 |
|
---|
40 | /**
|
---|
41 | * Get the mail representation of the notification.
|
---|
42 | *
|
---|
43 | * @param mixed $notifiable
|
---|
44 | * @return \Illuminate\Notifications\Messages\MailMessage
|
---|
45 | */
|
---|
46 | public function toMail($notifiable)
|
---|
47 | {
|
---|
48 | $hashId = new Hashid();
|
---|
49 |
|
---|
50 | return (new MailMessage)
|
---|
51 | ->greeting("Login verification")
|
---|
52 | ->line("To verify click the button and enter your security code.")
|
---|
53 | ->line("Your security code is: " . $this->user->security_code)
|
---|
54 | ->action("Verify", route("verify-login.index", [
|
---|
55 | "id" => $hashId->encode($this->user->id),
|
---|
56 | "token" => $this->user->verify_token
|
---|
57 | ]));
|
---|
58 | }
|
---|
59 |
|
---|
60 | /**
|
---|
61 | * Get the array representation of the notification.
|
---|
62 | *
|
---|
63 | * @param mixed $notifiable
|
---|
64 | * @return array
|
---|
65 | */
|
---|
66 | public function toArray($notifiable)
|
---|
67 | {
|
---|
68 | return [
|
---|
69 | //
|
---|
70 | ];
|
---|
71 | }
|
---|
72 | }
|
---|