mivita/app/Mail/MailCheckout.php
2019-02-28 18:09:54 +01:00

69 lines
No EOL
2.4 KiB
PHP

<?php
namespace App\Mail;
use App\User;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
use App\Services\Util;
class MailCheckout extends Mailable
{
use Queueable, SerializesModels;
public $txaction;
public $shopping_order;
public $shopping_payment;
public $subject;
public $data;
public function __construct($txaction, $shopping_order, $shopping_payment)
{
$this->txaction = $txaction;
$this->shopping_order = $shopping_order;
$this->shopping_payment = $shopping_payment;
$this->subject = __('Deine Bestellung auf mivita.care');
if($shopping_order->user_shop){
$this->subject = __('Deine Bestellung auf '.$shopping_order->user_shop->slug.'.mivita.care');
}
}
public function build()
{
$salutation = __('Dear customer').",";
if($this->shopping_order->shopping_user){
$salutation = __('Hallo')." ".$this->shopping_order->shopping_user->billing_firstname." ".$this->shopping_order->shopping_user->billing_lastname.",";
//make Adresse
}
if($this->txaction == 'paid'){
return $this->view('emails.checkout')->with([
'salutation' => $salutation,
'copy1line' => __('vielen Dank für Deine Bestellung bei mivita.care.<br><br>Nachfolgend haben wir zur Kontrolle Deine Bestellung noch einmal aufgelistet.'),
'shopping_order' => $this->shopping_order,
'shopping_payment' => $this->shopping_payment,
'copy3line' => __('Bei Fragen sind wir jederzeit für Dich da.'),
'greetings' => __('Best regards'),
'sender' => __('your mivita.care team'),
]);
}else{
return $this->view('emails.checkout_status')->with([
'salutation' => $salutation,
'copy1line' => "Status zu Deiner Bestellung bei mivita.care",
'txactionn' => $this->txaction,
'shopping_order' => $this->shopping_order,
'shopping_payment' => $this->shopping_payment,
'copy3line' => __('Bei Fragen sind wir jederzeit für Dich da.'),
'greetings' => __('Best regards'),
'sender' => __('your mivita.care team'),
]);
}
}
}