Files
nuhodds_fi4/app/Mail/SofaScoreDataMail.php
T
2026-07-25 18:23:26 +02:00

65 lines
1.5 KiB
PHP

<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Attachment;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;
use App\Console\Commands\Grapper\Sofascore;
class SofaScoreDataMail extends Mailable
{
use Queueable, SerializesModels;
/**
* Create a new message instance.
*/
public function __construct(string $header, string $message)
{
$this->header = $header;
$this->message = $message;
$this->archive_name = Sofascore::$archive_name;
$this->zip_file = Sofascore::$storage . Sofascore::$archive_name;
}
/**
* Get the message envelope.
*/
public function envelope(): Envelope
{
return new Envelope(
subject: $this->header,
);
}
/**
* Get the message content definition.
*/
public function content(): Content
{
return new Content(
markdown: 'mail.user.sofascore_data',
with: [
'message' => $this->message,
],
);
}
/**
* Get the attachments for the message.
*
* @return array<int, Attachment>
*/
public function attachments(): array
{
return [
Attachment::fromPath($this->zip_file)
->as($this->archive_name)
->withMime('application/x-zip-compressed')
];
}
}