first commit
This commit is contained in:
76
app/Models/PropertyBookingEngine.php
Normal file
76
app/Models/PropertyBookingEngine.php
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
class PropertyBookingEngine extends BaseModel
|
||||
{
|
||||
/**
|
||||
* The database table used by the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'property_booking_engine';
|
||||
protected $appends = ['parametersArray'];
|
||||
|
||||
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 mixed
|
||||
*/
|
||||
|
||||
public function getParametersArrayAttribute()
|
||||
{
|
||||
$parameters = null;
|
||||
if (!is_null($this->parameters)) {
|
||||
$parametersArray = json_decode($this->parameters, 1);
|
||||
if (is_array($parametersArray)) {
|
||||
$parameters = $parametersArray;
|
||||
}
|
||||
}
|
||||
|
||||
return $parameters;
|
||||
}
|
||||
|
||||
public function property()
|
||||
{
|
||||
return $this->hasOne("App\Models\Property", 'id', 'property_id')
|
||||
->select(['id', 'name', 'country', 'destination_id','property_type_id','mapping']);
|
||||
}
|
||||
|
||||
public function channel()
|
||||
{
|
||||
return $this->hasOne("App\Models\PropertyChannel", 'id', 'channel_id')->select(['id', 'name', 'token', 'channel_category_id', 'contact']);
|
||||
}
|
||||
|
||||
public function propertyWeb()
|
||||
{
|
||||
return $this->hasOne('App\Models\PropertyWeb', 'property_id', 'property_id')
|
||||
->where('status', '=', 1)
|
||||
->select("id", "property_id", "domain", "default_language", "template_id", "token");
|
||||
}
|
||||
|
||||
public function propertyChannelMapping()
|
||||
{
|
||||
return $this->hasOne('App\Models\PropertyChannelMapping', 'property_id', 'property_id')
|
||||
->where('channel_id', '=', 1)
|
||||
->select("id", "property_id", "channel_id", "currency_code", "channel_tax_id", "status");
|
||||
}
|
||||
|
||||
public function propertyWebComponent()
|
||||
{
|
||||
return $this->hasMany('App\Models\PropertyWebComponentMapping','property_id', 'property_id')
|
||||
->select('id','property_id','channel_id','component_id','parameter','language','status')->where('status',1);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user