126 lines
No EOL
4.8 KiB
PHP
126 lines
No EOL
4.8 KiB
PHP
<?php
|
|
namespace App\Services;
|
|
|
|
use App\Models\Airport;
|
|
use App\Models\Branch;
|
|
use App\Models\Status;
|
|
use App\Models\DraftType;
|
|
use App\Models\CMSContent;
|
|
use App\Models\Salutation;
|
|
use App\Models\SfGuardUser;
|
|
use App\Models\TravelAgenda;
|
|
use App\Models\TravelCompany;
|
|
use App\Models\TravelCountry;
|
|
use App\Models\TravelCategory;
|
|
use App\Models\ServiceProvider;
|
|
use App\Models\TravelNationality;
|
|
use App\Models\Sym\TravelCountry as SymTravelCountry;
|
|
use App\Models\TravelArrivalPoint;
|
|
use App\Models\TravelGerneralNote;
|
|
use App\Models\TravelProgram;
|
|
|
|
class Model
|
|
{
|
|
|
|
public static function getSfGuardUserArray(){
|
|
return SfGuardUser::where('is_active', 1)->get()->pluck('fullname', 'id');
|
|
}
|
|
|
|
public static function getTravelCountryArray($emtpy = false){
|
|
$TravelCountry = TravelCountry::where('active_backend', 1)->orderBy('name')->get()->pluck('name', 'id');
|
|
return $emtpy ? $TravelCountry->prepend('-', 0) : $TravelCountry;
|
|
}
|
|
|
|
public static function getTravelCountryCRMArray($emtpy = false){
|
|
$TravelCountry = TravelCountry::where('active_backend', 1)->orderBy('name')->get()->pluck('name', 'crm_id');
|
|
return $emtpy ? $TravelCountry->prepend('-', 0) : $TravelCountry;
|
|
}
|
|
|
|
public static function getTravelProgramArray($emtpy = false){
|
|
$TravelProgram = TravelProgram::where('status', 1)->orderBy('title')->get()->pluck('title', 'id');
|
|
return $emtpy ? $TravelProgram->prepend('-', 0) : $TravelProgram;
|
|
}
|
|
|
|
public static function getTravelCategoryArray($emtpy = false){
|
|
$TravelCategory = TravelCategory::where('active', true)->orderBy('name')->get()->pluck('name', 'id');
|
|
return $emtpy ? $TravelCategory->prepend('-', 0) : $TravelCategory;
|
|
}
|
|
|
|
public static function getTravelAgendaArray($emtpy = false, $travelcountry_id = false){
|
|
if($travelcountry_id){
|
|
$TravelAgenda = TravelAgenda::where('travelcountry_id', $travelcountry_id)->where('active', true)->orderBy('name')->get()->pluck('name', 'id');
|
|
}else{
|
|
$TravelAgenda = TravelAgenda::orderBy('name')->get()->pluck('name', 'id');
|
|
}
|
|
return $emtpy ? $TravelAgenda->prepend('-', 0) : $TravelAgenda;
|
|
}
|
|
|
|
public static function getSymTravelCountryArray($emtpy = false){
|
|
$SymTravelCountry = SymTravelCountry::orderBy('name')->get()->pluck('name', 'id');
|
|
return $emtpy ? $SymTravelCountry->prepend('-', 0) : $SymTravelCountry;
|
|
}
|
|
|
|
public static function getStatusArray($emtpy = false){
|
|
$Status = Status::orderBy('name')->get()->pluck('name', 'id');
|
|
return $emtpy ? $Status->prepend('-', 0) : $Status;
|
|
}
|
|
|
|
public static function getTravelCompanyArray($emtpy = false){
|
|
$TravelCompany = TravelCompany::where('active', true)->orderBy('name')->get()->pluck('name', 'id');
|
|
return $emtpy ? $TravelCompany->prepend('-', 0) : $TravelCompany;
|
|
}
|
|
|
|
|
|
public static function getAirportArray($emtpy = false){
|
|
$Airports = Airport::where('active', true)->orderBy('name')->get()->pluck('name', 'id');
|
|
return $emtpy ? $Airports->prepend('-', 0) : $Airports;
|
|
}
|
|
|
|
public static function getTravelArrivalPointArray($emtpy = false){
|
|
$TravelArrivalPoint = TravelArrivalPoint::where('active', true)->orderBy('name')->get()->pluck('name', 'id');
|
|
return $emtpy ? $TravelArrivalPoint->prepend('-', 0) : $TravelArrivalPoint;
|
|
}
|
|
|
|
public static function getTravelGerneralNotesArray($emtpy = false){
|
|
$TravelGerneralNote = TravelGerneralNote::orderBy('name')->get()->pluck('name', 'id');
|
|
return $emtpy ? $TravelGerneralNote->prepend('-', 0) : $TravelGerneralNote;
|
|
}
|
|
|
|
|
|
public static function getBranchArray($emtpy = false){
|
|
$Branch = Branch::orderBy('name')->get()->pluck('name', 'id');
|
|
return $emtpy ? $Branch->prepend('-', 0) : $Branch;
|
|
}
|
|
|
|
public static function getServiceProviderArray($emtpy = false, $type='payment'){
|
|
$ServiceProvider = ServiceProvider::where('type', $type)->orderBy('name')->get()->pluck('name', 'id');
|
|
return $emtpy ? $ServiceProvider->prepend('-', 0) : $ServiceProvider;
|
|
}
|
|
|
|
public static function getSalutationArray($emtpy = false){
|
|
$Salutation = Salutation::orderBy('id')->get()->pluck('name', 'id');
|
|
return $emtpy ? $Salutation->prepend('-', 0) : $Salutation;
|
|
}
|
|
|
|
public static function getSalutationById($id){
|
|
$Salutation = Salutation::find($id);
|
|
return $Salutation ? $Salutation->name : '';
|
|
}
|
|
public static function getTravelNationalityArray($emtpy = false){
|
|
$TravelNationality = TravelNationality::where('active', true)->orderBy('name')->get()->pluck('name', 'id');
|
|
return $emtpy ? $TravelNationality->prepend('-', 0) : $TravelNationality;
|
|
}
|
|
|
|
public static function getDraftTypeArray($emtpy = false){
|
|
$DraftType = DraftType::where('active', true)->orderByDesc('pos')->get()->pluck('name', 'id');
|
|
return $emtpy ? $DraftType->prepend('-', 0) : $DraftType;
|
|
}
|
|
|
|
public static function getCMSContentGeneralNameById($id = false){
|
|
if($id != 'new' && $id > 0){
|
|
$content = CMSContent::findOrFail($id);
|
|
return $content->name;
|
|
}
|
|
return "";
|
|
}
|
|
} |