OwnerStoreFeeDetail.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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 OwnerStoreFeeDetail extends Model
  7. {
  8. use ModelLogChanging;
  9. public $fillable = [
  10. 'owner_fee_detail_id',
  11. 'unit_id',
  12. 'unit_price', //单价
  13. 'amount', //数量
  14. 'owner_id', //货主
  15. 'fee',//费用
  16. 'commodity_id',
  17. 'packing_material_fee',//包材费
  18. 'tax_fee',//税费
  19. 'sku',//sku
  20. 'barcode',//条码
  21. 'work_name',//作业名称
  22. 'asn_code',//asn号
  23. ];
  24. public function ownerFeeDetail(): BelongsTo
  25. {
  26. return $this->belongsTo(OwnerFeeDetail::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. public function owner(): BelongsTo
  37. {
  38. return $this->belongsTo(Owner::class);
  39. }
  40. public function commodity(): BelongsTo
  41. {
  42. return $this->belongsTo(Commodity::class);
  43. }
  44. }