mein-sterntours/app/Mail/MailSendFeWoInfo.php
2019-05-06 20:21:40 +02:00

57 lines
No EOL
1.8 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 MailSendFeWoInfo extends Mailable
{
use Queueable, SerializesModels;
protected $travel_user_booking_fewo;
public $subject;
public function __construct(TravelUserBookingFewo $travel_user_booking_fewo)
{
$this->travel_user_booking_fewo = $travel_user_booking_fewo;
$this->subject = __('STERN TOURS Anreiseinfo 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' => $this->travel_user_booking_fewo->getTravelInfoPathFile(),
'name' => 'Stern-Tours-'.$this->travel_user_booking_fewo->getTravelInfoFileName(),
'mine' => 'application/pdf',
);
return $this->view('emails.info')
->with([
'salutation' => $salutation,
'copy1line' => $this->travel_user_booking_fewo->info_mail_text,
'copy2line' => "",
'greetings' => __('Best regards'),
'model' => $this->travel_user_booking_fewo,
])
->attach($file1['path'], [
'as' => $file1['name'],
'mime' => $file1['mine'],
])
;
}
}