80 lines
No EOL
2.4 KiB
PHP
80 lines
No EOL
2.4 KiB
PHP
<?php
|
|
namespace App\Services;
|
|
|
|
use App\Models\Airline;
|
|
use App\Models\CMSContent;
|
|
use App\Models\Insurance;
|
|
use App\Models\TravelCompany;
|
|
|
|
class Booking
|
|
{
|
|
public static function contentFiles(){
|
|
$booking_email_files = CMSContent::where('identifier', '=', 'booking-email-file')->get()->sortByDesc('pos')->pluck('slug', 'id');
|
|
return $booking_email_files;
|
|
}
|
|
|
|
|
|
public static function getCustomerMailDirs(){
|
|
$customer_mail_dirs = CMSContent::where('identifier', '=', 'customer-mail-dirs')->get()->sortBy('pos');
|
|
return $customer_mail_dirs;
|
|
}
|
|
|
|
|
|
public static function getCustomerMailDir($id){
|
|
return CMSContent::where('identifier', '=', 'customer-mail-dirs')->where('pos', '=', $id)->first();
|
|
}
|
|
|
|
public static function getCustomerMailName($customer_mail_dir, $mail_dir_id){
|
|
|
|
switch ($customer_mail_dir->getArrayContent('model')){
|
|
case 'TravelCountry':
|
|
$model = \App\Models\Sym\TravelCountry::find($mail_dir_id);
|
|
break;
|
|
case 'Airline':
|
|
$model = Airline::find($mail_dir_id);
|
|
break;
|
|
case 'Insurance':
|
|
$model = Insurance::find($mail_dir_id);
|
|
break;
|
|
case 'TravelCompany':
|
|
$model = TravelCompany::find($mail_dir_id);
|
|
break;
|
|
default:
|
|
return '';
|
|
}
|
|
|
|
if($model){
|
|
if($customer_mail_dir->getArrayContent('model') === 'TravelCountry'){
|
|
return $model->mail_dir_name;
|
|
}
|
|
return $model->name;
|
|
}
|
|
return "";
|
|
}
|
|
|
|
public static function getCustomerMailEmails($customer_mail_dir, $mail_dir_id){
|
|
|
|
switch ($customer_mail_dir->getArrayContent('model')){
|
|
case 'TravelCountry':
|
|
$model = \App\Models\Sym\TravelCountry::find($mail_dir_id);
|
|
break;
|
|
case 'Airline':
|
|
$model = Airline::find($mail_dir_id);
|
|
break;
|
|
case 'Insurance':
|
|
$model = Insurance::find($mail_dir_id);
|
|
break;
|
|
case 'TravelCompany':
|
|
$model = TravelCompany::find($mail_dir_id);
|
|
break;
|
|
default:
|
|
//direkt from CMSContent
|
|
return $customer_mail_dir->getArrayContent('emails');
|
|
}
|
|
|
|
if($model){
|
|
return $model->contact_emails;
|
|
}
|
|
return [];
|
|
}
|
|
} |