47 lines
1,021 B
PHP
47 lines
1,021 B
PHP
<?php
|
|
|
|
namespace App\Jobs;
|
|
|
|
use App\Enums\Claims\ClaimStatus;
|
|
use App\Mail\TransferredToDigitalCountMail;
|
|
use App\Models\Claim;
|
|
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\Mail;
|
|
|
|
class SendTransferredToDigitalCountMail implements ShouldQueue
|
|
{
|
|
use Dispatchable;
|
|
use InteractsWithQueue;
|
|
use Queueable;
|
|
use SerializesModels;
|
|
|
|
/**
|
|
* Create a new job instance.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function __construct()
|
|
{
|
|
}
|
|
|
|
/**
|
|
* Execute the job.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function handle(): void
|
|
{
|
|
$count = Claim::query()->where('status', ClaimStatus::sentDigital)->count();
|
|
|
|
if ($count <= 0) {
|
|
return;
|
|
}
|
|
|
|
Mail::to(config('mail.digital_service'))
|
|
->send(new TransferredToDigitalCountMail($count));
|
|
}
|
|
}
|