![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/mcoil.corals.io/app/Shop/Blogs/ |
<?php namespace App\Shop\Blogs; use Illuminate\Database\Eloquent\Model; use App\Shop\CategoryBoxes\CategoryBox; class Blog extends Model { /** * The attributes that are mass assignable. * * @var array */ protected $fillable = [ 'title', 'sub_title', 'category_id', 'header_img', 'contentOne', 'imageOne', 'videoOne', 'contentTwo', 'imageTwo', 'videoTwo', 'contentThree', 'meta_title', 'meta_description', 'meta_keywords', 'canonical', 'noindex', 'meta_og_title', 'meta_og_description', 'meta_og_image', 'signature', 'tags', 'created_at', 'updated_at', 'meta_alt_img1', 'meta_alt_img2', 'slug', 'author' ]; public function setTagsAttribute($value) { if(!empty($value)){ $this->attributes['tags'] = json_encode($value); } else { $this->attributes['tags'] = null; } } /*public function setContentOneAttribute($value) { if(!empty($value)){ $this->attributes['contentOne'] = htmlspecialchars_decode($this->attributes['contentOne']); } else { $this->attributes['contentOne'] = null; } } public function setContentTwoAttribute($value) { if(!empty($value)){ $this->attributes['contentTwo'] = htmlspecialchars_decode($this->attributes['contentTwo']); } else { $this->attributes['contentTwo'] = null; } } public function setContentThreeAttribute($value) { if(!empty($value)){ $this->attributes['contentThree'] = htmlspecialchars_decode($this->attributes['contentThree']); } else { $this->attributes['contentThree'] = null; } }*/ public function getTagsAttribute() { if(!empty($this->attributes['tags']) && !is_array($this->attributes['tags'])) { $this->attributes['tags'] = json_decode($this->attributes['tags'],true); } else if(!empty($this->attributes['tags']) && is_array($this->attributes['tags'])) { $this->attributes['tags'] = $this->attributes['tags']; } else { $this->attributes['tags'] = []; } return $this->attributes['tags']; } public function getHeaderImgAttribute() { if(!empty($this->attributes['header_img'])) { return \Storage::url($this->attributes['header_img']); } else { return 'images/Pattern/Green-Dots.jpg'; } } /* public function getImageOneAttribute() { if(!empty($this->attributes['imageOne'])) { return $this->attributes['imageOne']; } else { return 'images/NewsEntry/News-Entry-Sample.jpg'; } } public function getImageTwoAttribute() { if(!empty($this->attributes['imageTwo'])) { return $this->attributes['imageTwo']; } }*/ public function category() { return $this->hasOne(CategoryBox::class,'id','category_id')->whereSection('blog'); } }