source:
app/Notifications/VerifyUser.php@
0a1fb54
| Last change on this file since 0a1fb54 was 0a1fb54, checked in by , 4 years ago | |
|---|---|
|
|
| File size: 1.6 KB | |
| Rev | Line | |
|---|---|---|
| [194a359] | 1 | <?php |
| 2 | ||
| 3 | namespace App\Notifications; | |
| 4 | ||
| [1c25bcf] | 5 | use App\Models\Company; |
| [194a359] | 6 | use App\Models\User; |
| [1c25bcf] | 7 | use App\Services\Hashid; |
| [194a359] | 8 | use Illuminate\Bus\Queueable; |
| [1c25bcf] | 9 | use Illuminate\Contracts\Queue\ShouldQueue; |
| [194a359] | 10 | use Illuminate\Notifications\Messages\MailMessage; |
| [1c25bcf] | 11 | use Illuminate\Notifications\Notification; |
| [194a359] | 12 | |
| [1c25bcf] | 13 | class VerifyUser extends Notification implements ShouldQueue |
| [194a359] | 14 | { |
| 15 | use Queueable; | |
| 16 | ||
| [1c25bcf] | 17 | protected $user; |
| [194a359] | 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 | * | |
| [1c25bcf] | 32 | * @param mixed $notifiable |
| [194a359] | 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 | * | |
| [1c25bcf] | 43 | * @param mixed $notifiable |
| [194a359] | 44 | * @return \Illuminate\Notifications\Messages\MailMessage |
| 45 | */ | |
| 46 | public function toMail($notifiable) | |
| 47 | { | |
| [1c25bcf] | 48 | $hashId = new Hashid(); |
| 49 | ||
| [194a359] | 50 | return (new MailMessage) |
| [1c25bcf] | 51 | ->greeting("Login verification") |
| 52 | ->line("To verify click the button and enter your security code.") | |
| [194a359] | 53 | ->line("Your security code is: " . $this->user->security_code) |
| [1c25bcf] | 54 | ->action("Verify", route("verify-login.index", [ |
| 55 | "id" => $hashId->encode($this->user->id), | |
| 56 | "token" => $this->user->verify_token | |
| 57 | ])); | |
| [194a359] | 58 | } |
| 59 | ||
| 60 | /** | |
| 61 | * Get the array representation of the notification. | |
| 62 | * | |
| [1c25bcf] | 63 | * @param mixed $notifiable |
| [194a359] | 64 | * @return array |
| 65 | */ | |
| 66 | public function toArray($notifiable) | |
| 67 | { | |
| 68 | return [ | |
| 69 | // | |
| 70 | ]; | |
| 71 | } | |
| 72 | } |
Note:
See TracBrowser
for help on using the repository browser.
