first commit
This commit is contained in:
59
app/Models/PropertyChannel.php
Normal file
59
app/Models/PropertyChannel.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Support\Facades\Config;
|
||||
|
||||
class PropertyChannel extends BaseModel
|
||||
{
|
||||
/**
|
||||
* The database table used by the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'property_channel';
|
||||
protected $appends = ['logoUrl', 'countryCodeGroupArray'];
|
||||
|
||||
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 getLogoUrlAttribute()
|
||||
{
|
||||
//return Config::get('app.client_server') . '/assets/img/brands/' . $this->id . '.png';
|
||||
return Config::get('app.client_server') . '/assets/img/brands/' . $this->logo;
|
||||
}
|
||||
|
||||
public function getCountryCodeGroupArrayAttribute()
|
||||
{
|
||||
if (!is_null($this->country_code_group)) {
|
||||
return json_decode($this->country_code_group, 1);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function propertyChannelCategory()
|
||||
{
|
||||
return $this->hasOne('App\Models\PropertyChannelCategory', 'id', 'channel_category_id')->select(['id', 'name', 'language_key']);
|
||||
}
|
||||
|
||||
public function parentChannel()
|
||||
{
|
||||
return $this->hasOne('App\Models\PropertyChannel', 'id', 'parent_id')->select(['id', 'parent_id', 'name', 'official_name', 'description', 'channel_category_id', 'country_code', 'currency_code', 'default_currency', 'logo', 'address', 'zip_code', 'email', 'phone', 'phone2', 'fax', 'score', 'status']);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user