source: app/Notifications/VerifyUser.php@ cbb901a

develop
Last change on this file since cbb901a was 1c25bcf, checked in by Berat Kjufliju <kufliju@…>, 3 years ago

added 2fa, bug fixes, edited blades

  • Property mode set to 100644
File size: 1.6 KB
Line 
1<?php
2
3namespace App\Notifications;
4
5use App\Models\Company;
6use App\Models\User;
7use App\Services\Hashid;
8use Illuminate\Bus\Queueable;
9use Illuminate\Contracts\Queue\ShouldQueue;
10use Illuminate\Notifications\Messages\MailMessage;
11use Illuminate\Notifications\Notification;
12
13class 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
73
74}
Note: See TracBrowser for help on using the repository browser.