belongsTo('App\SpecialContent'); } // public function getDetailsAttribute() // { // return json_decode($this->attributes['details']); // } // public function setDetailsAttribute($value) // { // $this->attributes['details'] = json_encode($value, JSON_UNESCAPED_UNICODE); // } public function optionable() { return $this->morphTo(); } public function files() { return $this->morphMany('App\Upload', 'uploadable')->select('id', 'uploadable_id', 'uploadable_type', 'user_id', 'path'); } public function gallery() { return $this->morphMany('App\Upload', 'uploadable')->wherePivot('image_role', 'Gallery')->where('parent_id', null); } public function orginalTitleImage() { return $this->morphToMany('App\Gallery', 'uploadable')->wherePivot('image_role', 'TitleImage')->where('parent_id', null); } public function title_image() { return $this->morphToMany('App\Gallery', 'uploadable')->wherePivot('image_role', 'TitleImage')->where('parent_id', null); } public function images() { return $this->morphToMany('App\Gallery', 'uploadable'); } }