'array', // ]; public function getDetailAttribute($value) { return $value ? json_decode($value) : []; } /** * @return BelongsTo */ public function segment(): BelongsTo { return $this->BelongsTo(Segment::class, 'segment_id', 'id'); } /** * @return mixed */ public function service(){ return $this->hasOne(ServiceType::class, 'id', 'detail->id') ->whereIn('reference', [SegmentConstants::SERVICE_TYPE, SegmentConstants::CUSTOM_SERVICE_TYPE]); } }