OwnerStoreFeeReport.php 961 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. namespace App;
  3. use Illuminate\Database\Eloquent\Model;
  4. use App\Traits\ModelLogChanging;
  5. use Illuminate\Database\Eloquent\Relations\BelongsTo;
  6. class OwnerStoreFeeReport extends Model
  7. {
  8. use ModelLogChanging;
  9. public $fillable = [
  10. 'owner_bill_report_id',
  11. 'owner_id',
  12. 'counting_month', //统计月份
  13. 'unit_id', //单位
  14. 'unit_price', //单价
  15. 'amount', //数量
  16. 'fee',//费用
  17. 'work_name',//作业名称
  18. ];
  19. public $timestamps = false;
  20. public function ownerBillReport(): BelongsTo
  21. {
  22. return $this->belongsTo(OwnerBillReport::class);
  23. }
  24. public function owner(): BelongsTo
  25. {
  26. return $this->belongsTo(Owner::class);
  27. }
  28. public function unit(): BelongsTo
  29. {
  30. return $this->belongsTo(Unit::class);
  31. }
  32. public function getPriceAttribute(): string
  33. {
  34. return $this->unit_price . '/' . $this->unit->name;
  35. }
  36. }