08 2024
This commit is contained in:
parent
c1c613a4b9
commit
881fc84207
384 changed files with 50679 additions and 990 deletions
|
|
@ -110,6 +110,12 @@ class Feedback extends Page
|
|||
{
|
||||
protected $table = 'page';
|
||||
|
||||
protected $fillable = [
|
||||
'title', 'status', 'slug', 'date', 'content', 'content_new', 'box_body', 'description', 'pagetitle', 'keywords', 'order', 'active',
|
||||
];
|
||||
|
||||
protected $casts = ['box_body' => 'array', 'date' => 'date', 'status' => 'boolean', 'active' => 'boolean'];
|
||||
|
||||
public static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
|
@ -150,6 +156,24 @@ class Feedback extends Page
|
|||
}
|
||||
}
|
||||
|
||||
public function getContentAttribute()
|
||||
{
|
||||
return $this->attributes['content_new'] === null ? $this->attributes['content'] : $this->attributes['content_new'];
|
||||
}
|
||||
|
||||
public function setContentNewAttribute($value)
|
||||
{
|
||||
if (!$value) {
|
||||
$this->attributes['content_new'] = $value;
|
||||
} else {
|
||||
$this->attributes['content_new'] = HTMLHelper::filterHTML($value, ['src' => ['removeHost']], true);
|
||||
}
|
||||
}
|
||||
|
||||
public function getContentNewAttribute()
|
||||
{
|
||||
return $this->attributes['content_new'] === null ? $this->attributes['content'] : $this->attributes['content_new'];
|
||||
}
|
||||
|
||||
|
||||
public function getParentsArray(){
|
||||
|
|
@ -173,8 +197,19 @@ class Feedback extends Page
|
|||
if (!$value) {
|
||||
$this->attributes['date'] = null;
|
||||
} else {
|
||||
$this->attributes['date'] = (new Carbon($value))->format('Y-m-d');
|
||||
|
||||
try {
|
||||
$this->attributes['date']= Carbon::parse($value);
|
||||
} catch (\Exception $e) {
|
||||
$this->attributes['date'] = Carbon::now();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function getImage($key){
|
||||
//use box_body for images
|
||||
if(isset($this->box_body[$key])){
|
||||
return $this->box_body[$key];
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue