enhance components, add mailtemplate, add traits for translations, for stats
This commit is contained in:
58
app/Mail/ConfirmationCommande.php
Normal file
58
app/Mail/ConfirmationCommande.php
Normal 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 ConfirmationCommande 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);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user