44 lines
1 KiB
PHP
44 lines
1 KiB
PHP
<?php
|
|
|
|
namespace App\Jobs;
|
|
|
|
use App\Mail\EmployeePasswordResetMail;
|
|
use App\Models\Employee;
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Illuminate\Foundation\Bus\Dispatchable;
|
|
use Illuminate\Queue\InteractsWithQueue;
|
|
use Illuminate\Queue\SerializesModels;
|
|
use Illuminate\Support\Facades\Log;
|
|
use Illuminate\Support\Facades\Mail;
|
|
|
|
class SendMailResetPasswordToEmployee implements ShouldQueue
|
|
{
|
|
use Dispatchable;
|
|
use InteractsWithQueue;
|
|
use Queueable;
|
|
use SerializesModels;
|
|
|
|
protected $employee;
|
|
|
|
/**
|
|
* Create a new job instance.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function __construct(Employee $employee)
|
|
{
|
|
$this->employee = $employee;
|
|
}
|
|
|
|
/**
|
|
* Execute the job.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function handle()
|
|
{
|
|
Mail::to(['email' => $this->employee->token->email])->send(new EmployeePasswordResetMail($this->employee));
|
|
Log::debug(sprintf('Sent %s to %s', EmployeePasswordResetMail::class, config('mail.contactsList.contact')));
|
|
}
|
|
}
|