hasMany('App\Models\PostImgs', 'post_id', 'id'); } public function data() { return $this->hasOne('App\Models\PostData', 'post_id', 'id'); } public function topic() { return Topic::whereIn('id', explode(',', $this->topic_ids))->pluck('name', 'id'); } public function comment(){ return $this->hasOne('App\Models\PostComment', 'post_id', 'id'); } }