OwnerStoreFeeReport.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. 'model_id',//计费模型
  19. 'tax_fee',//税费
  20. ];
  21. public $timestamps = false;
  22. public function ownerBillReport(): BelongsTo
  23. {
  24. return $this->belongsTo(OwnerBillReport::class);
  25. }
  26. public function owner(): BelongsTo
  27. {
  28. return $this->belongsTo(Owner::class);
  29. }
  30. public function unit(): BelongsTo
  31. {
  32. return $this->belongsTo(Unit::class);
  33. }
  34. public function getPriceAttribute(): string
  35. {
  36. return $this->unit_price . '/' . $this->unit->name;
  37. }
  38. public function model(): BelongsTo
  39. {
  40. return $this->belongsTo(OwnerPriceOperation::class, 'model_id', 'id');
  41. }
  42. }