finish implementing mails

This commit is contained in:
Ludovic CANDELLIER
2023-04-17 00:27:03 +02:00
parent 24e518fffe
commit 313525a25b
8 changed files with 274 additions and 49 deletions

View File

@@ -3,6 +3,7 @@
namespace App\Mail;
use App\Models\Core\Mail\MailTemplate;
use App\Repositories\Shop\Invoices;
use App\Repositories\Shop\Traits\MailCustomers;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
@@ -14,18 +15,42 @@ class Acheminement extends TemplateMailable
protected static $templateModelClass = MailTemplate::class;
public $user;
public $email;
public $male;
public $nom;
public $prenom;
public $societe;
public $subject;
public $url;
public $numero_suivi;
public function __construct($user, $subject = '')
public $numero_commande;
public $adresse;
public $cp;
public $ville;
public $date_expedition;
public $facture;
public function __construct($order)
{
$this->user = $user;
$this->male = $user->gender == 1;
$this->subject = $subject;
$this->prenom = $order->customer->first_name;
$this->nom = $order->customer->last_name;
$this->adresse = $order->address->address;
$this->cp = $order->address->zipcode;
$this->ville = $order->address->city;
$this->societe = $order->customer->company;
$this->email = $order->customer->email;
$this->numero_suivi = $order->delivery_ref;
$this->numero_commande = $order->ref;
$this->date_expedition = $order->updated_at;
$this->facture = Invoices::getInvoiceHtml($order->invoice->id);
}
}

View File

@@ -24,12 +24,12 @@ class Preparation extends TemplateMailable
public $subject;
public function __construct($user, $subject = '')
public function __construct($order)
{
$this->prenom = $user->first_name;
$this->nom = $user->last_name;
$this->societe = $user->society;
$this->email = $user->email;
$this->prenom = $order->customer->first_name;
$this->nom = $order->customer->last_name;
$this->societe = $order->customer->company;
$this->email = $order->customer->email;
$this->subject = $subject;
}
}