53 lines
1.3 KiB
PHP
53 lines
1.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Notifications;
|
|
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Illuminate\Notifications\Messages\MailMessage;
|
|
use Illuminate\Notifications\Notification;
|
|
|
|
// NOTE: This may be be queued
|
|
class EmployeesExportIsDone extends Notification implements ShouldQueue
|
|
{
|
|
use Queueable;
|
|
|
|
/** 'failed_jobs' after */
|
|
public int $tries = 5;
|
|
|
|
/**
|
|
* Attempts delays
|
|
*
|
|
* @return array<int, int>
|
|
*/
|
|
public function backoff(): array
|
|
{
|
|
return [10, 30, 60, 300];
|
|
}
|
|
|
|
public function __construct(
|
|
#[\SensitiveParameter]
|
|
protected readonly string $fullname,
|
|
protected readonly string $filePath,
|
|
protected readonly string $disk,
|
|
) {
|
|
}
|
|
|
|
/** @return string[] */
|
|
public function via(object $notifiable): array
|
|
{
|
|
return ['mail'];
|
|
}
|
|
|
|
public function toMail(object $notifiable): MailMessage
|
|
{
|
|
return new MailMessage()
|
|
->subject(trans('Salary export - :appname', [
|
|
'appname' => config()->string('app.name'),
|
|
]))
|
|
->markdown('emails.send-csv', ['fullname' => $this->fullname])
|
|
->attachFromStorageDisk($this->disk, $this->filePath);
|
|
}
|
|
}
|