enhance components, add mailtemplate, add traits for translations, for stats

This commit is contained in:
Ludovic CANDELLIER
2023-02-13 22:52:39 +01:00
parent f2f4788ce1
commit 0ecc7c73c7
32 changed files with 891 additions and 277 deletions

58
app/Mail/Acheminement.php Normal file
View File

@@ -0,0 +1,58 @@
<?php
namespace App\Mail;
use App\Models\Core\Mail\MailTemplate;
use App\Repositories\Core\DateTime;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Spatie\MailTemplates\TemplateMailable;
use App\Repositories\Shop\Customers;
class Acheminement extends TemplateMailable
{
use Queueable, SerializesModels;
protected static $templateModelClass = MailTemplate::class;
public $user;
public $male;
public $subject;
public $url;
public function __construct($user, $subject = '')
{
$this->user = $user;
$this->male = $user->gender == 1;
$this->subject = $subject;
$this->from[] = ['address' => 'boutique@jardinenvie.com','name' => 'Boutique JardinEnVie'];
$this->reply_to = ['address' => 'boutique@jardinenvie.com','name' => 'Boutique JardinEnVie'];
}
public static function getDataByUser($user_id)
{
$user = self::getUser($user_id);
return $user ? [
'user' => $user->toArray(),
'male' => $user->gender == 1,
] : false;
}
public static function getUser($id)
{
return Customers::get($id);
}
public function build()
{
$data = ['user' => $this->user];
$template = $this->getTemplate();
return $this->view($template, $data);
}
}