SupervisorPasswordResetLink.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. namespace App\Mail;
  3. use Illuminate\Bus\Queueable;
  4. use Illuminate\Contracts\Queue\ShouldQueue;
  5. use Illuminate\Mail\Mailable;
  6. use Illuminate\Queue\SerializesModels;
  7. use App\User;
  8. class SupervisorPasswordResetLink extends Mailable
  9. {
  10. use Queueable, SerializesModels;
  11. public $supervisor, $info;
  12. public function __construct(User $supervisor)
  13. {
  14. $this->supervisor=$supervisor;
  15. $this->info['header']="Set a New Password";
  16. $this->info['token']=app('auth.password.broker')->createToken($supervisor);
  17. \DB::table('password_resets')->updateOrInsert(
  18. ['email' => $supervisor->email], [
  19. 'token' => bcrypt($this->info['token']),
  20. 'created_at'=>now()
  21. ]
  22. );
  23. }
  24. /**
  25. * Build the message.
  26. *
  27. * @return $this
  28. */
  29. public function build()
  30. {
  31. return $this->from(
  32. "asraful@revinr.com"
  33. )->view(
  34. 'email.supervisor_password_reset_link'
  35. )->subject('Password Reset Request: Set a New Password');
  36. }
  37. }