Files
click-erp/app/Jobs/SendOnboardingCompletedEmailAlert.php

51 lines
1.4 KiB
PHP

<?php
namespace App\Jobs;
use App\Models;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Contracts\Mail\Mailer;
class SendOnboardingCompletedEmailAlert implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
protected $client;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct(Models\Client $client)
{
$this->client = $client;
}
/**
* Execute the job.
*
* @return void
*/
public function handle(Mailer $mailer)
{
$client = $this->client;
$emails = ['samuel@click-mobile.com', 'kwesi@click-mobile.com'];
$data = [
'client' => $client->name,
'created_by' => $client->auth_user_info->name,
'country' => $client->country,
'company_type' => $client->company_type,
'contact_person' => $client->contact_person,
'how_we_got' => $client->how_we_got_client
];
$mailer->send('emails.onboarding_completed', $data, function ($message) use ($data, $emails) {
$message->from('alerts@click-mobile.com', 'Click Mobile ERP');
$message->to($emails)->subject('Onboarding Completed');
});
}
}