<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use App\Traits\ModelTimeFormat;

use App\Traits\ModelLogChanging;

class ProcessDaily extends Model
{
    use ModelLogChanging;

    use ModelTimeFormat;
    protected $fillable=[
        'process_id','date','output','remain'
    ];
    protected $appends=[
        'process_code'
    ];


    public function process(){
        return $this->belongsTo('App\Process','process_id','id');
    }
    public function processDailyParticipants(){
        return $this->hasMany('App\ProcessDailyParticipant','process_daily_id','id');
    }

    public function getProcessCodeAttribute()
    {
        return $this['process'] ? $this['process']['code'] : null;
    }
}
