38 lines
905 B
PHP
38 lines
905 B
PHP
<?php
|
|
|
|
namespace App\Jobs;
|
|
|
|
use App\Mail\OcbMissingBreederReminder;
|
|
use App\Models\OCBWaitingList;
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Illuminate\Foundation\Bus\Dispatchable;
|
|
use Illuminate\Queue\InteractsWithQueue;
|
|
use Illuminate\Support\Facades\Mail;
|
|
|
|
class SendOcbMissingBreederReminder implements ShouldQueue
|
|
{
|
|
use Dispatchable;
|
|
use InteractsWithQueue;
|
|
use Queueable;
|
|
|
|
/**
|
|
* Execute the job.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function handle()
|
|
{
|
|
$data = OCBWaitingList::all();
|
|
if (count($data)) {
|
|
Mail::to($this->getFormattedDest())->send(new OcbMissingBreederReminder($data));
|
|
}
|
|
}
|
|
|
|
private function getFormattedDest()
|
|
{
|
|
return array_map(function ($email) {
|
|
return ['email' => $email];
|
|
}, config('mail.contactsList.missingOcbBreeders'));
|
|
}
|
|
}
|