OwnerBillReport.php 704 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. namespace App;
  3. use Illuminate\Database\Eloquent\Model;
  4. class OwnerBillReport extends Model
  5. {
  6. protected $fillable = [
  7. "owner_id", //项目ID
  8. "counting_month", //结算月
  9. "initial_fee", //原始账单金额
  10. "confirm_fee", //确认账单金额
  11. "difference", //差额
  12. "confirmed", //确认状态
  13. ];
  14. public $timestamps=false;
  15. public function owner()
  16. { //货主
  17. return $this->hasOne(Owner::class,"id","owner_id");
  18. }
  19. /* 结算月格式转换,仅截取至月
  20. * 引用:CreateOwnerReport
  21. */
  22. public function getCountingMonthAttribute($value)
  23. {
  24. return substr($value,0,7);
  25. }
  26. }