42 lines
899 B
PHP
42 lines
899 B
PHP
<?php
|
|
|
|
namespace App\Repositories\Shop\Traits;
|
|
|
|
use App\Repositories\Shop\Customers;
|
|
use App\Repositories\Core\DateTime;
|
|
use Illuminate\Mail\Mailables\Address;
|
|
use Illuminate\Mail\Mailables\Envelope;
|
|
|
|
trait MailCustomers
|
|
{
|
|
public static function getContext()
|
|
{
|
|
return Customers::getOptions();
|
|
}
|
|
|
|
public static function getData($id)
|
|
{
|
|
$user = self::getUser($id);
|
|
|
|
return $user ? [
|
|
'prenom' => $user->first_name,
|
|
'nom' => $user->last_name,
|
|
'societe' => $user->society,
|
|
'email' => $user->email,
|
|
] : false;
|
|
}
|
|
|
|
public static function getUser($id)
|
|
{
|
|
return Customers::get($id);
|
|
}
|
|
|
|
public function envelope()
|
|
{
|
|
return new Envelope(
|
|
from: new Address('boutique@jardinenvie.com', 'Jardin\'en\'Vie'),
|
|
subject: $this->subject,
|
|
);
|
|
}
|
|
}
|