89 lines
2.1 KiB
PHP
89 lines
2.1 KiB
PHP
<?php
|
|
|
|
namespace App\Mail;
|
|
|
|
use App\Models\Service;
|
|
use App\Models\User;
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Mail\Mailable;
|
|
use Illuminate\Mail\Mailables\Address;
|
|
use Illuminate\Mail\Mailables\Content;
|
|
use Illuminate\Mail\Mailables\Envelope;
|
|
use Illuminate\Queue\SerializesModels;
|
|
|
|
class ServiceCredentialRenewed extends Mailable
|
|
{
|
|
use Queueable;
|
|
use SerializesModels;
|
|
|
|
/**
|
|
* The concerned service.
|
|
*
|
|
* @var \App\Models\Service
|
|
*/
|
|
public $service;
|
|
|
|
/**
|
|
* The user who did the action.
|
|
*
|
|
* @var \App\Models\User
|
|
*/
|
|
public $user;
|
|
|
|
/**
|
|
* Create a new message instance.
|
|
*
|
|
* @param \App\Models\Service $service
|
|
* @param \App\Models\User $user
|
|
*/
|
|
public function __construct(Service $service, User $user)
|
|
{
|
|
$this->service = $service;
|
|
$this->user = $user;
|
|
$this->service->load('arcadiaBrand');
|
|
}
|
|
|
|
/**
|
|
* Get the message envelope.
|
|
*
|
|
* @return \Illuminate\Mail\Mailables\Envelope
|
|
*/
|
|
public function envelope(): Envelope
|
|
{
|
|
return new Envelope(
|
|
subject: '!!! Warning !!!, New service credential have been generated !',
|
|
to: [new Address(
|
|
config('mail.contactsList.serviceweb', 'equipe.web@ldc.fr'),
|
|
sprintf('%s service warning', config('app.name'))
|
|
)]
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Get the message content definition.
|
|
*
|
|
* @return \Illuminate\Mail\Mailables\Content
|
|
*/
|
|
public function content(): Content
|
|
{
|
|
return new Content(
|
|
markdown: 'emails.service-renewed',
|
|
with: [
|
|
'appName' => config('app.name'),
|
|
'service' => $this->service,
|
|
'brand' => $this->service->arcadiaBrand,
|
|
'by' => sprintf('%s %s (%s)', $this->user->first_name, $this->user->last_name, $this->user->email),
|
|
]
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Get the attachments for the message.
|
|
*
|
|
* @return array<int, \Illuminate\Mail\Mailables\Attachment>
|
|
*/
|
|
public function attachments(): array
|
|
{
|
|
return [];
|
|
}
|
|
}
|