First Commit

This commit is contained in:
Kevin Adametz 2018-10-29 09:15:36 +01:00
commit 0c9a118281
633 changed files with 76612 additions and 0 deletions

73
app/Models/Account.php Normal file
View file

@ -0,0 +1,73 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
/**
* App\Models\Account
*
* @property-read \App\Models\Country $company_country
* @property-read \App\Models\Country $company_pre_phone
* @property-read \App\Models\Country $country
* @property-read mixed $company
* @property-read \App\Models\Country $pre_mobil
* @property-read \App\Models\Country $pre_phone
* @property-read \App\User $user
* @method static bool|null forceDelete()
* @method static \Illuminate\Database\Query\Builder|\App\Models\Account onlyTrashed()
* @method static bool|null restore()
* @method static \Illuminate\Database\Query\Builder|\App\Models\Account withTrashed()
* @method static \Illuminate\Database\Query\Builder|\App\Models\Account withoutTrashed()
* @mixin \Eloquent
*/
class Account extends Model
{
protected $table = 'accounts';
use SoftDeletes;
protected $dates = ['deleted_at'];
public function user()
{
return $this->belongsTo('App\User');
}
public function company_country()
{
return $this->belongsTo('App\Models\Country', 'company_country_id');
}
public function country()
{
return $this->belongsTo('App\Models\Country', 'country_id');
}
public function company_pre_phone()
{
return $this->belongsTo('App\Models\Country', 'company_pre_phone_id');
}
public function pre_phone()
{
return $this->belongsTo('App\Models\Country', 'pre_phone_id');
}
public function pre_mobil()
{
return $this->belongsTo('App\Models\Country', 'pre_mobil_id');
}
public function getCompanyAttribute(){
if(empty($this->attributes['company']) && @$this->attributes['company'] !== 0){
return 1;
}
return $this->attributes['company'];
}
}

84
app/Models/Country.php Normal file
View file

@ -0,0 +1,84 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use PHPUnit\Framework\Constraint\Count;
/**
* App\Models\Country
*
* @property int $id
* @property string $code
* @property string $phone
* @property string $en
* @property string $de
* @property string $es
* @property string $fr
* @property string $it
* @property string $ru
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Country whereCode($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Country whereDe($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Country whereEn($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Country whereEs($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Country whereFr($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Country whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Country whereIt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Country wherePhone($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Country whereRu($value)
* @mixin \Eloquent
*/
class Country extends Model
{
protected $connection = 'mysql';
protected $table = 'countries';
public function getLocated($lang = 'de'){
$lang = \App::getLocale();
if($lang == 'de'){
return $this->de;
}
if($lang == 'en'){
return $this->en;
}
if($lang == 'es'){
return $this->es;
}
if($lang == 'fr'){
return $this->fr;
}
if($lang == 'it'){
return $this->it;
}
if($lang == 'ru'){
return $this->ru;
}
return $this->de;
}
public static function getCountryIdByCode($code){
if($code == null){
return null;
}
$r = Country::where('code', '=', $code)->first();
if($r){
return $r->id;
}
return null;
}
public static function getCountryIdByPhone($phone){
if($phone == null){
return null;
}
$r = Country::where('phone', '=', $phone)->first();
if($r){
return $r->id;
}
return null;
}
}

69
app/Models/Draft.php Normal file
View file

@ -0,0 +1,69 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
/**
* App\Models\Draft
*
* @property int $id
* @property string $name
* @property int $active
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Draft whereActive($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Draft whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Draft whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Draft whereName($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Draft whereUpdatedAt($value)
* @mixin \Eloquent
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\DraftItem[] $draft_items
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\TravelProgramDraft[] $travel_program_drafts
*/
class Draft extends Model
{
protected $connection = 'mysql';
protected $table = 'drafts';
public function draft_items()
{
return $this->hasMany('App\Models\DraftItem', 'draft_id', 'id')->orderBy('pos', 'ASC');
}
public function travel_program_drafts()
{
return $this->hasMany(TravelProgramDraft::class, 'draft_id', 'id');
}
public function findBeforeRelation($reid)
{
$before = false;
foreach($this->draft_items as $draft_item) {
if ($draft_item->id == $reid) {
return $before;
}
$before = $draft_item;
}
return false;
}
public function findAfterRelation($reid)
{
$next = false;
foreach($this->draft_items as $draft_item) {
if($next){
return $draft_item;
}
if ($draft_item->id == $reid) {
$next = true;
}
}
return false;
}
}

108
app/Models/DraftItem.php Normal file
View file

@ -0,0 +1,108 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
/**
* App\Models\DraftItem
*
* @property int $id
* @property int $draft_id
* @property int $draft_type_id
* @property int|null $days_start
* @property int|null $days_duration
* @property string|null $name
* @property float|null $price_adult
* @property int|null $adult
* @property float|null $price_children
* @property int|null $children
* @property string|null $content
* @property int|null $pos
* @property int $in_pdf
* @property int $active
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @property-read \App\Models\Draft $draft
* @property-read \App\Models\DraftType $draft_type
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\DraftItem whereActive($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\DraftItem whereAdult($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\DraftItem whereChildren($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\DraftItem whereContent($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\DraftItem whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\DraftItem whereDaysDuration($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\DraftItem whereDaysStart($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\DraftItem whereDraftId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\DraftItem whereDraftTypeId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\DraftItem whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\DraftItem whereInPdf($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\DraftItem whereName($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\DraftItem wherePos($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\DraftItem wherePriceAdult($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\DraftItem wherePriceChildren($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\DraftItem whereUpdatedAt($value)
* @mixin \Eloquent
* @property string|null $service
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\DraftItem whereService($value)
*/
class DraftItem extends Model
{
protected $connection = 'mysql';
protected $table = 'draft_items';
protected $fillable = [
'pos',
];
public function draft()
{
return $this->belongsTo('App\Models\Draft', 'draft_id');
}
public function draft_type()
{
return $this->belongsTo('App\Models\DraftType', 'draft_type_id');
}
public function _format_number($value){
return preg_replace("/[^0-9,]/", "", $value);
}
public function setPriceAdultAttribute($value)
{
$value = $this->_format_number($value);
$this->attributes['price_adult'] = floatval(str_replace(',', '.', $value));
}
public function getPriceAdultAttribute()
{
// 2 = decimal places | '.' = decimal seperator | ',' = thousand seperator
return number_format(($this->attributes['price_adult']), 2, ',', '.');
}
public function getPriceAdultRaw()
{
return isset($this->attributes['price_adult']) ? $this->attributes['price_adult'] : 0;
}
public function setPriceChildrenAttribute($value)
{
$value = $this->_format_number($value);
$this->attributes['price_children'] = floatval(str_replace(',', '.', $value));
}
public function getPriceChildrenAttribute()
{
// 2 = decimal places | '.' = decimal seperator | ',' = thousand seperator
return number_format(($this->attributes['price_children']), 2, ',', '.');
}
public function getPriceChildrenRaw()
{
return isset($this->attributes['price_children']) ? $this->attributes['price_children'] : 0;
}
}

37
app/Models/DraftType.php Normal file
View file

@ -0,0 +1,37 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
/**
* App\Models\DraftType
*
* @property int $id
* @property string $name
* @property int $active
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\DraftType whereActive($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\DraftType whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\DraftType whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\DraftType whereName($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\DraftType whereUpdatedAt($value)
* @mixin \Eloquent
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\DraftItem[] $draft_items
*/
class DraftType extends Model
{
protected $connection = 'mysql';
protected $table = 'draft_types';
protected $fillable = [
'name', 'active',
];
public function draft_items()
{
return $this->hasMany('App\Models\DraftItem', 'draft_type_id', 'id');
}
}

59
app/Models/SfGuardUser.php Executable file
View file

@ -0,0 +1,59 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
/**
* App\Models\SfGuardUser
*
* @property int $id
* @property int|null $user_id
* @property string $username
* @property string $algorithm
* @property string|null $salt
* @property string|null $password
* @property int|null $is_active
* @property int|null $is_super_admin
* @property string|null $last_login
* @property string|null $first_name
* @property string|null $last_name
* @property string|null $email_address
* @property string|null $default_page
* @property int|null $branch_id
* @property string|null $api_key
* @property string|null $identify
* @property string|null $token
* @property string|null $token_at
* @property \Illuminate\Support\Carbon $created_at
* @property \Illuminate\Support\Carbon $updated_at
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SfGuardUser whereAlgorithm($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SfGuardUser whereApiKey($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SfGuardUser whereBranchId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SfGuardUser whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SfGuardUser whereDefaultPage($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SfGuardUser whereEmailAddress($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SfGuardUser whereFirstName($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SfGuardUser whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SfGuardUser whereIdentify($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SfGuardUser whereIsActive($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SfGuardUser whereIsSuperAdmin($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SfGuardUser whereLastLogin($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SfGuardUser whereLastName($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SfGuardUser wherePassword($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SfGuardUser whereSalt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SfGuardUser whereToken($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SfGuardUser whereTokenAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SfGuardUser whereUpdatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SfGuardUser whereUserId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SfGuardUser whereUsername($value)
* @mixin \Eloquent
*/
class SfGuardUser extends Model
{
protected $connection = 'mysql';
protected $table = 'sf_guard_user';
}

View file

@ -0,0 +1,39 @@
<?php
namespace App\Models\Sym;
use Illuminate\Database\Eloquent\Model;
/**
* App\Models\Sym\Arrangement
*
* @property int $id
* @property int|null $template_id
* @property string|null $state
* @property string|null $begin
* @property string|null $end
* @property string|null $type_s
* @property string|null $data_s
* @property int|null $view_position
* @property int|null $booking_id
* @property int $type_id
* @property int|null $in_pdf
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Sym\Arrangement whereBegin($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Sym\Arrangement whereBookingId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Sym\Arrangement whereDataS($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Sym\Arrangement whereEnd($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Sym\Arrangement whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Sym\Arrangement whereInPdf($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Sym\Arrangement whereState($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Sym\Arrangement whereTemplateId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Sym\Arrangement whereTypeId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Sym\Arrangement whereTypeS($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Sym\Arrangement whereViewPosition($value)
* @mixin \Eloquent
*/
class Arrangement extends Model
{
protected $table = 'arrangement';
}

View file

@ -0,0 +1,27 @@
<?php
namespace App\Models\Sym;
use Illuminate\Database\Eloquent\Model;
/**
* App\Models\Sym\ArrangementTemplate
*
* @property int $id
* @property string|null $title
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\Sym\Arrangement[] $arrangements
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Sym\ArrangementTemplate whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Sym\ArrangementTemplate whereTitle($value)
* @mixin \Eloquent
*/
class ArrangementTemplate extends Model
{
protected $table = 'arrangement_template';
public function arrangements()
{
return $this->hasMany('App\Models\Sym\Arrangement', 'template_id', 'id')->orderBy('view_position', 'DESC');
}
}

View file

@ -0,0 +1,52 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
/**
* App\Models\TravelClass
*
* @property int $id
* @property string|null $name
* @property string|null $description
* @property int|null $program_id
* @property int $standard
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @property-read \App\Models\TravelProgram|null $travel_program
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelClass whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelClass whereDescription($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelClass whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelClass whereName($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelClass whereProgramId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelClass whereStandard($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelClass whereUpdatedAt($value)
* @mixin \Eloquent
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\TravelProgramDraft[] $travel_program_drafts
*/
class TravelClass extends Model
{
//use the connection to sec. Datebase sterntours
protected $connection = 'mysql_stern';
protected $table = 'travel_class';
protected $fillable = [
'program_id',
'name',
'description',
'standard',
];
public function travel_program()
{
return $this->belongsTo('App\Models\TravelProgram', 'program_id');
}
public function travel_program_drafts()
{
return $this->hasMany('App\Models\TravelProgramDraft', 'travel_class_id', 'id');
}
}

View file

@ -0,0 +1,158 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
/**
* App\Models\TravelProgram
*
* @property int $id
* @property float|null $profit_margin
* @property int|null $category_id
* @property string|null $program_code
* @property int|null $program_duration
* @property int|null $is_seasonal
* @property int|null $youth
* @property string|null $title
* @property string|null $subtitle
* @property string|null $slider_info
* @property int|null $program_type
* @property int|null $crm_draft_id_standard
* @property int|null $crm_draft_id_comfort
* @property int|null $organizer
* @property int|null $generalnote
* @property int|null $status
* @property string|null $included
* @property string|null $class_description
* @property string|null $excluded
* @property string|null $advices
* @property string|null $notes
* @property string|null $url
* @property int|null $max_age_for_children
* @property string|null $html_description
* @property int|null $insurance_1
* @property int|null $insurance_2
* @property int|null $insurance_3
* @property int $in_slider
* @property int $show_map
* @property string|null $map_html
* @property string $map_image
* @property string $map_image_ext
* @property int|null $travel_country
* @property int|null $travel_category
* @property int|null $travel_agenda
* @property int|null $deposit_percent
* @property int|null $netto_prices_in_euro
* @property string|null $text_right
* @property float|null $default_flight_price
* @property int|null $travel_arrival_point_id
* @property string|null $weekdays
* @property int|null $position
* @property float|null $discount
* @property int|null $discount_is_percent_value
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereAdvices($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereCategoryId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereClassDescription($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereCrmDraftIdComfort($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereCrmDraftIdStandard($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereDefaultFlightPrice($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereDepositPercent($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereDiscount($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereDiscountIsPercentValue($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereExcluded($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereGeneralnote($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereHtmlDescription($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereInSlider($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereIncluded($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereInsurance1($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereInsurance2($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereInsurance3($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereIsSeasonal($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereMapHtml($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereMapImage($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereMapImageExt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereMaxAgeForChildren($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereNettoPricesInEuro($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereNotes($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereOrganizer($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram wherePosition($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereProfitMargin($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereProgramCode($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereProgramDuration($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereProgramType($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereShowMap($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereSliderInfo($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereStatus($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereSubtitle($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereTextRight($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereTitle($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereTravelAgenda($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereTravelArrivalPointId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereTravelCategory($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereTravelCountry($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereUrl($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereWeekdays($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereYouth($value)
* @mixin \Eloquent
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\TravelClass[] $classes
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereUpdatedAt($value)
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\TravelProgramDraft[] $travel_program_drafts
*/
class TravelProgram extends Model
{
//use the connection to sec. Datebase sterntours
protected $connection = 'mysql_stern';
protected $table = 'travel_program';
protected $fillable = [
'title',
'subtitle',
'program_code',
'weekdays',
'status',
];
public function classes()
{
return $this->hasMany('App\Models\TravelClass', 'program_id', 'id');
}
public function travel_program_drafts()
{
return $this->hasMany('App\Models\TravelProgramDraft', 'travel_program_id', 'id');
}
public function getWeekdaysArray(){
if($this->weekdays){
return explode(',', $this->weekdays);
}
if($this->weekdays !== NULL){
return array(0);
}
return [];
}
public function setWeekdaysFromArray($value){
if($value){
if(is_array($value)){
if($value[0] === NULL){
$this->weekdays = "0,1,2,3,4,5,6";
}else{
$this->weekdays = implode(',', $value);
}
}else{
$this->weekdays = $value;
}
return $this->weekdays;
}
return "";
}
}

View file

@ -0,0 +1,58 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
/**
* App\Models\TravelProgramDraft
*
* @property int $id
* @property int $travel_program_id
* @property int $travel_class_id
* @property int $draft_id
* @property array $weekdays
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @property-read \App\Models\Draft $draft
* @property-read \App\Models\TravelClass $travel_class
* @property-read \App\Models\TravelProgram $travel_program
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgramDraft whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgramDraft whereDraftId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgramDraft whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgramDraft whereTravelClassId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgramDraft whereTravelProgramId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgramDraft whereUpdatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgramDraft whereWeekdays($value)
* @mixin \Eloquent
*/
class TravelProgramDraft extends Model
{
//use the connection to sec. Datebase sterntours
protected $connection = 'mysql_stern';
protected $table = 'travel_program_drafts';
protected $casts = ['weekdays' => 'array'];
protected $fillable = [
'travel_program_id',
'travel_class_id',
'draft_id',
'weekdays',
];
public function travel_program()
{
return $this->belongsTo('App\Models\TravelProgram', 'travel_program_id');
}
public function travel_class()
{
return $this->belongsTo('App\Models\TravelClass', 'travel_class_id');
}
public function draft()
{
return $this->belongsTo(Draft::class, 'draft_id', 'id');
}
}

View file

@ -0,0 +1,27 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
/**
* App\Models\UserUpdateEmail
*
* @property-read \App\User $user
* @mixin \Eloquent
*/
class UserUpdateEmail extends Model
{
protected $connection = 'mysql';
protected $table = 'users_update_email';
protected $fillable = [
'user_id', 'email', 'token',
];
public function user()
{
return $this->belongsTo('App\User', 'user_id');
}
}