98 lines
No EOL
3.5 KiB
PHP
98 lines
No EOL
3.5 KiB
PHP
<?php
|
|
namespace App\Services;
|
|
|
|
use App\Models\Branch;
|
|
use App\Models\Status;
|
|
use App\Models\DraftType;
|
|
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;
|
|
|
|
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 getTravelCategoryArray($emtpy = false){
|
|
$TravelCategory = TravelCategory::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 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('name')->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;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} |