EmailVerificationNotification.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. namespace App\Notifications;
  3. use Carbon\Carbon;
  4. use Illuminate\Bus\Queueable;
  5. use Illuminate\Notifications\Notification;
  6. use Illuminate\Notifications\Messages\MailMessage;
  7. use Illuminate\Support\Facades\URL;
  8. use App\Mail\EmailManager;
  9. use Auth;
  10. use App\Models\User;
  11. class EmailVerificationNotification extends Notification
  12. {
  13. use Queueable;
  14. public function __construct()
  15. {
  16. }
  17. public function via($notifiable)
  18. {
  19. return ['mail'];
  20. }
  21. public function toMail($notifiable)
  22. {
  23. $notifiable->verification_code = encrypt($notifiable->id);
  24. $notifiable->save();
  25. $array['view'] = 'emails.verification';
  26. $array['subject'] = translate('Email Verification');
  27. $array['content'] = translate('Please click the button below to verify your email address.');
  28. $array['link'] = route('email.verification.confirmation', $notifiable->verification_code);
  29. return (new MailMessage)
  30. ->view('emails.verification', ['array' => $array])
  31. ->subject(translate('Email Verification - ').env('APP_NAME'));
  32. }
  33. public function toArray($notifiable)
  34. {
  35. return [
  36. //
  37. ];
  38. }
  39. }