68 lines
No EOL
2.4 KiB
PHP
68 lines
No EOL
2.4 KiB
PHP
<?php
|
|
namespace App\Mail;
|
|
|
|
use App\Models\TravelUserBookingFewo;
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Mail\Mailable;
|
|
use Illuminate\Queue\SerializesModels;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Storage;
|
|
|
|
class MailSendFeWoInvoice extends Mailable
|
|
{
|
|
use Queueable, SerializesModels;
|
|
|
|
protected $travel_user_booking_fewo;
|
|
protected $notice;
|
|
public $subject;
|
|
|
|
|
|
public function __construct(TravelUserBookingFewo $travel_user_booking_fewo, $notice)
|
|
{
|
|
$this->travel_user_booking_fewo = $travel_user_booking_fewo;
|
|
$this->notice = $notice;
|
|
$this->subject = __('STERN TOURS Mietbestätigung FEWO');
|
|
}
|
|
|
|
public function build()
|
|
{
|
|
$salutation = __('Dear customer').",";
|
|
if($this->travel_user_booking_fewo->travel_user){
|
|
if($this->travel_user_booking_fewo->travel_user->salutation_id == 1){
|
|
$salutation = __('Dear Sir')." ".$this->travel_user_booking_fewo->travel_user->last_name.",";
|
|
}else{
|
|
$salutation = __('Dear Mrs')." ".$this->travel_user_booking_fewo->travel_user->last_name.",";
|
|
}
|
|
}
|
|
|
|
$file1 = array(
|
|
'path' => Storage::disk('public')->path("pdf/Stern-Tours-Mietbedingungen.pdf"),
|
|
'name' => 'Stern-Tours-Mietbedingungen.pdf',
|
|
'mine' => 'application/pdf',
|
|
);
|
|
|
|
$file2 = array(
|
|
'path' => $this->travel_user_booking_fewo->getInvoicePathFile(),
|
|
'name' => 'Stern-Tours-'.$this->travel_user_booking_fewo->getInvoiceFileName(),
|
|
'mine' => 'application/pdf',
|
|
);
|
|
|
|
return $this->view('emails.invoice')
|
|
->with([
|
|
'salutation' => $salutation,
|
|
'copy1line' => "herzlichen Dank für Ihre Online-Buchung vom ".$this->travel_user_booking_fewo->booking_date.", hiermit bestätigen wir verbindlich Ihre Anmietung wie folgt:",
|
|
'copy2line' => '',
|
|
'notice' => $this->notice,
|
|
'greetings' => __('Best regards'),
|
|
'model' => $this->travel_user_booking_fewo,
|
|
])
|
|
->attach($file1['path'], [
|
|
'as' => $file1['name'],
|
|
'mime' => $file1['mine'],
|
|
])
|
|
->attach($file2['path'], [
|
|
'as' => $file2['name'],
|
|
'mime' => $file2['mine'],
|
|
]);
|
|
}
|
|
} |