<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class OwnerBillReport extends Model
{
   protected $fillable = [
       "owner_id",       //项目ID
       "counting_month", //结算月
       "initial_fee",    //原始账单金额
       "confirm_fee",    //确认账单金额
       "difference",     //差额
       "confirmed",      //确认状态
   ];
   public $timestamps=false;

   public function owner()
   {   //货主
       return $this->hasOne(Owner::class,"id","owner_id");
   }

    /* 结算月格式转换，仅截取至月
     * 引用：CreateOwnerReport
     */
    public function getCountingMonthAttribute($value)
    {
        return substr($value,0,7);
    }
}
