<?php namespace App\Mail; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Mail\Mailable; use Illuminate\Queue\SerializesModels; use App\User; class ApplicantPasswordResetLink extends Mailable { use Queueable, SerializesModels; public $applicant, $info; public function __construct(User $applicant) { $this->applicant=$applicant; $this->info['header']="Set a New Password"; $this->info['token']=app('auth.password.broker')->createToken($applicant); \DB::table('password_resets')->updateOrInsert( ['email' => $applicant->email], [ 'token' => bcrypt($this->info['token']), 'created_at'=>now() ] ); } /** * Build the message. * * @return $this */ public function build() { return $this->from( "asraful@revinr.com" )->view( 'email.applicant_password_reset_link' )->subject('Applicant Password Reset Link'); } }