Fewo Mails / Booking Country Services
This commit is contained in:
parent
b9c26d06d0
commit
48a6eb2282
154 changed files with 7761 additions and 1643 deletions
80
app/Services/Booking.php
Normal file
80
app/Services/Booking.php
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
<?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 [];
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue