OwnerBillReport.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace App;
  3. use Illuminate\Database\Eloquent\Model;
  4. use App\Traits\ModelLogChanging;
  5. class OwnerBillReport extends Model
  6. {
  7. use ModelLogChanging;
  8. protected $fillable = [
  9. "owner_id", //项目ID
  10. "counting_month", //结算月
  11. "work_fee", //操作费
  12. "logistic_fee", //物流费
  13. "storage_fee", //仓储费
  14. "confirm_fee", //确认账单金额
  15. "difference", //差额
  16. "confirmed", //确认状态
  17. "other_fee", //其他费用
  18. "storage_tax_fee",//仓储税费
  19. "other_tax_fee", //其他税费
  20. ];
  21. protected $appends=[
  22. "initial_fee"
  23. ];
  24. public $timestamps=false;
  25. public function owner()
  26. { //货主
  27. return $this->hasOne(Owner::class,"id","owner_id");
  28. }
  29. /* 结算月格式转换,仅截取至月
  30. * 引用:CreateOwnerReport
  31. */
  32. public function getCountingMonthAttribute($value)
  33. {
  34. return substr($value,0,7);
  35. }
  36. public function getInitialFeeAttribute()
  37. { //初始账单金额
  38. return $this->work_fee + $this->logistic_fee + $this->storage_fee + $this->other_fee;
  39. }
  40. }