<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class ClaimLine extends Model
{

    protected $table = 'claim_line';

    public function claimLineIcds(){
        return $this->hasMany(ClaimLineIcd::class, 'claim_line_id', 'id');
    }

    public function icds(){
        $icdList = [];
        foreach($this->claimLineIcds as $icd){
            $icdList[] = $icd->code;
        }

        return implode (", ", $icdList);
    }

}
