hasMany(PostCategory::class,'post_id'); } public function tags() { return $this->hasMany(PostTag::class,'post_id'); } public function setPubishTimeAttr($value) { return strtotime($value); } public function setContentAttr($value) { return json_encode($value); } public function getContentAttr($value) { return json_decode($value,true); } public function getPosterAttr($value) { if(empty($value)){ $value = '/static/images/avatar.jpeg'; } return get_source_link($value); } }