ldc-com-app-bo/app/Jobs/Mails/SendTenantDeletedMail.php
2025-06-04 12:10:04 +02:00

46 lines
976 B
PHP

<?php
namespace App\Jobs\Mails;
use App\Mail\TenantDeleted;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Support\Facades\Mail;
class SendTenantDeletedMail implements ShouldQueue
{
use Dispatchable;
use InteractsWithQueue;
/** @var string $author */
private $author;
/** @var string $name */
private $name;
/**
* Create a new job instance.
*
* @param string $author
* @param string $name
* @return void
*/
public function __construct(string $author, string $name)
{
$this->author = $author;
$this->name = $name;
}
/**
* Execute the job.
*
* @return void
*/
public function handle(): void
{
foreach (config('mail.to.address') as $address) {
Mail::to($address)->send(new TenantDeleted($this->author, $this->name));
}
}
}