46 lines
966 B
PHP
46 lines
966 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
class PropertyFactMapping extends BaseModel
|
|
{
|
|
/**
|
|
* The database table used by the model.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $table = 'property_fact_mapping';
|
|
protected $appends = ['descriptionArray'];
|
|
|
|
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
|
|
*/
|
|
function getDescriptionArrayAttribute()
|
|
{
|
|
$description = [];
|
|
if (!empty($this->description)) {
|
|
$description = json_decode($this->description, 1);
|
|
}
|
|
return $description;
|
|
}
|
|
|
|
public function fact()
|
|
{
|
|
return $this->hasOne("App\Models\PropertyFact", 'id', 'fact_id')->select('id', 'parent_id', 'name', 'icon', 'language_key');
|
|
}
|
|
|
|
}
|