'json']; protected $appends = ['image']; public function getImageAttribute($value) { if (empty($this->image_id)) return []; return Upload::whereIn('id', $this->image_id)->get(); } public function image() { return $this->hasOne(Upload::class, 'id', 'image_id'); } }