ldc-crm/app/Mail/ServiceCredentialRenewed.php

56 lines
1.4 KiB
PHP
Raw Permalink Normal View History

<?php
namespace App\Mail;
use App\Models\Service;
use App\Models\User;
use Illuminate\Mail\Mailable;
class ServiceCredentialRenewed extends Mailable
{
/**
* 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.
*
2023-06-23 17:18:59 +02:00
* @param \App\Models\Service $service
* @param \App\Models\User $user
*/
public function __construct(Service $service, User $user)
{
$this->service = $service;
$this->user = $user;
}
/**
* Build the message.
*
* @return \Illuminate\Mail\Mailable
*/
public function build(): \Illuminate\Mail\Mailable
{
return $this->view('mail.service-renewed')
->subject('!!! Warning !!!, New service credential have been generated !')
->text('mail.service-renewed-plain')
->with('appName', config('app.name'))
->with('service', $this->service)
2023-10-06 15:00:42 +02:00
->with('by', sprintf('%s %s (%s)', $this->user->first_name, $this->user->last_name, $this->user->email))
->to(
config('mail.contactsList.serviceweb', 'equipe.web@ldc.fr'),
sprintf('%s service warning', config('app.name'))
);
}
}