first commit
This commit is contained in:
202
app/Models/Property.php
Normal file
202
app/Models/Property.php
Normal file
@@ -0,0 +1,202 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
class Property extends BaseModel
|
||||
{
|
||||
/**
|
||||
* The database table used by the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'property';
|
||||
protected $appends = [];
|
||||
|
||||
const CREATED_AT = 'created_at';
|
||||
const UPDATED_AT = 'updated_at';
|
||||
|
||||
protected $dateFormat = 'U';
|
||||
protected $guarded = [];
|
||||
|
||||
/**
|
||||
* The attributes excluded from the model's JSON form.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $hidden = [];
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function propertyPhotos()
|
||||
{
|
||||
return $this->hasMany('App\Models\PropertyPhoto', 'property_id', 'id')
|
||||
->where('status', '=', 1);
|
||||
}
|
||||
|
||||
public function propertyExecutive()
|
||||
{
|
||||
return $this->hasMany('App\Models\PropertyExecutive', 'property_id', 'id');
|
||||
}
|
||||
|
||||
public function propertyUser()
|
||||
{
|
||||
return $this->hasMany('App\Models\UserPropertyMapping', 'property_id', 'id');
|
||||
}
|
||||
|
||||
public function propertyContractUser()
|
||||
{
|
||||
return $this->hasOne('App\Models\User', 'id', 'contract_user_id');
|
||||
}
|
||||
|
||||
public function propertyType()
|
||||
{
|
||||
return $this->belongsTo('App\Models\PropertyType', 'property_type_id', 'id')
|
||||
->select('id', 'name', 'language_key');
|
||||
}
|
||||
|
||||
|
||||
public function defaultPropertyPhoto()
|
||||
{
|
||||
return $this->hasOne('App\Models\PropertyPhoto', 'property_id', 'id')
|
||||
->where('is_default', '=', 1);
|
||||
}
|
||||
|
||||
|
||||
public function propertyChain()
|
||||
{
|
||||
return $this->hasOne('App\Models\PropertyChain', 'id', 'chain_id')
|
||||
->select('id', 'name');
|
||||
}
|
||||
|
||||
public function propertyDestination()
|
||||
{
|
||||
return $this->hasOne('App\Models\Destination', 'id', 'destination_id')->select('id', 'name');
|
||||
}
|
||||
|
||||
public function propertyRooms()
|
||||
{
|
||||
return $this->hasMany('App\Models\PropertyRoom', 'property_id', 'id')
|
||||
->select(
|
||||
'id', 'property_id', 'name', 'room_type_id', 'max_occupancy', 'max_adult', 'max_child', 'max_child_number',
|
||||
'exclude_occupancy', 'room_type_count', 'room_size', 'room_size_type', 'room_count', 'bathroom_count', 'lounge_count'
|
||||
)
|
||||
->where('status', '=', 1);
|
||||
|
||||
}
|
||||
|
||||
public function propertyBrand()
|
||||
{
|
||||
return $this->hasOne('App\Models\PropertyBrand', 'property_id', 'id')->select(['id', 'property_id', 'title', 'color_codes', 'logo_name', 'logo_file_ext']);
|
||||
}
|
||||
|
||||
|
||||
public function propertyContact()
|
||||
{
|
||||
return $this->hasOne('App\Models\PropertyContact', 'property_id', 'id')
|
||||
->select(['id', 'property_id', 'phone_code', 'phone', 'mobile_code', 'mobile', 'mobile2_code', 'mobile2', 'fax_code', 'fax', 'email', 'web', 'meta', 'social_media_addresses', 'zip_code', 'address', 'latitude', 'longitude']);
|
||||
}
|
||||
|
||||
public function propertyWeb()
|
||||
{
|
||||
return $this->hasOne('App\Models\PropertyWeb', 'property_id', 'id')
|
||||
->select(['id', 'property_id', 'domain', 'default_language', 'template_id', 'token', 'status', 'is_dns_checked', 'is_ssl_active', 'is_published'])
|
||||
->orderBy('id', 'DESC');
|
||||
}
|
||||
|
||||
public function propertyWebRooms()
|
||||
{
|
||||
return $this->hasMany('App\Models\PropertyWebRoomMapping', 'property_id', 'id')
|
||||
->select('id', 'property_id', 'property_room_id')
|
||||
->where('status', '=', 1);
|
||||
}
|
||||
|
||||
public function propertyBookingEngineGroupMapping()
|
||||
{
|
||||
return $this->hasMany('App\Models\PropertyGroupMapping', 'property_id', 'id')
|
||||
->select(['id', 'property_id', 'property_group_id', 'order_number', 'status'])
|
||||
->where('status', '=', 1);
|
||||
}
|
||||
|
||||
public function propertyBookingEngineToken()
|
||||
{
|
||||
return $this->hasOne('App\Models\PropertyBookingEngine', 'property_id', 'id')
|
||||
->select(['id', 'property_id', 'channel_id', 'token', 'status'])
|
||||
->where('channel_id', '=', 1)
|
||||
->where('status', '=', 1);
|
||||
}
|
||||
|
||||
public function propertyBookingEngines()
|
||||
{
|
||||
return $this->hasMany('App\Models\PropertyBookingEngine', 'property_id', 'id')
|
||||
->select(['id', 'property_id', 'channel_id', 'token', 'status'])
|
||||
->where('status', '=', 1);
|
||||
}
|
||||
|
||||
public function propertyLanguageSpoken()
|
||||
{
|
||||
return $this->hasMany('App\Models\PropertyLanguageSpoken', 'property_id', 'id')
|
||||
->select('id', 'property_id', 'language_code', 'status')
|
||||
->where('status', '=', 1);
|
||||
|
||||
}
|
||||
|
||||
public function propertyAwardsCertificates()
|
||||
{
|
||||
return $this->hasMany('App\Models\PropertyAwardsCertificate', 'property_id', 'id')
|
||||
->select('id', 'property_id', 'category_id', 'name', 'date', 'url', 'file_path', 'file_type', 'language_code', 'status');
|
||||
|
||||
}
|
||||
|
||||
public function propertyAdditionalInfos()
|
||||
{
|
||||
return $this->hasMany('App\Models\PropertyAdditionalInfo', 'property_id', 'id')->select('id', 'property_id', 'additional_info_key_id', 'value');
|
||||
|
||||
}
|
||||
|
||||
public function propertyProductMapping()
|
||||
{
|
||||
return $this->hasMany('App\Models\PropertyProductMapping', 'property_id', 'id')->select('id', 'property_id', 'product_id', 'expiration_date', 'status');
|
||||
}
|
||||
|
||||
public function userPropertyMapping()
|
||||
{
|
||||
return $this->hasMany('App\Models\UserPropertyMapping', 'property_id', 'id')->select('id', 'property_id', 'user_id', 'status')->where('status', '=', 1);
|
||||
}
|
||||
|
||||
public function propertyPlace()
|
||||
{
|
||||
return $this->hasMany('App\Models\PropertyPlace', 'property_id', 'id')->select('id', 'property_id', 'name', 'place_category_id', 'description', 'status')->where('status', '=', 1);
|
||||
}
|
||||
|
||||
public function country()
|
||||
{
|
||||
return $this->hasOne('App\Models\Country', 'country_code', 'country')->select('name', 'language_key', 'country_code');
|
||||
}
|
||||
|
||||
public function propertyWebComponent()
|
||||
{
|
||||
return $this->hasMany('App\Models\PropertyWebComponentMapping', 'property_id', 'id')->select('id', 'property_id', 'channel_id', 'component_id', 'status')->where('status', '=', 1);
|
||||
}
|
||||
|
||||
public function propertyPromotionMapping()
|
||||
{
|
||||
return $this->hasMany('App\Models\PropertyPromotionMapping', 'property_id', 'id')->select('id', 'property_id', 'room_rate_channel_mapping_id', 'property_promotion_id', 'status')->where('status', '=', 1);
|
||||
}
|
||||
|
||||
public function propertyFactMapping()
|
||||
{
|
||||
return $this->hasMany('App\Models\PropertyFactMapping', 'property_id', 'id')->select('id', 'property_id', 'fact_id');
|
||||
}
|
||||
|
||||
public function propertyPaymentMapping()
|
||||
{
|
||||
return $this->hasMany('App\Models\PropertyPaymentMapping', 'property_id', 'id')->select('id', 'property_id', 'payment_type_id', 'status');
|
||||
}
|
||||
|
||||
public function propertyStatus()
|
||||
{
|
||||
return $this->hasOne('App\Models\PropertyStatus', 'id', 'status')->select('id', 'name', 'status');
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user