OwnerStoreOutFeeDetail.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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 OwnerStoreOutFeeDetail extends Model
  7. {
  8. use ModelLogChanging;
  9. public $fillable = [
  10. 'owner_fee_detail_id',//
  11. 'commodity_id',//
  12. 'owner_id',//
  13. 'source_bill', // 上游单号
  14. 'unit_price', //价格
  15. 'unit_id', //
  16. 'amount',//数量
  17. 'step',//阶梯
  18. 'price_remark',//价格描述
  19. 'tax_fee',//税费
  20. 'sku',//商家编码
  21. 'packing_material_fee',//耗材费
  22. 'barcode',//商品条码
  23. 'work_name',//作业名称
  24. 'fee',//费用
  25. ];
  26. public function ownerFeeDetail(): BelongsTo
  27. {
  28. return $this->belongsTo(OwnerFeeDetail::class);
  29. }
  30. public function commodity(): BelongsTo
  31. {
  32. return $this->belongsTo(Commodity::class);
  33. }
  34. public function owner(): BelongsTo
  35. {
  36. return $this->belongsTo(Owner::class);
  37. }
  38. public function unit(): BelongsTo
  39. {
  40. return $this->belongsTo(Unit::class);
  41. }
  42. /**
  43. * 根据插入数组构建查询数组
  44. * @param $data
  45. * @return array
  46. */
  47. public static function buildSelectData($data): array
  48. {
  49. return [
  50. 'owner_fee_detail_id' => $data['owner_fee_detail_id'] ?? '',
  51. 'commodity_id' => $data['commodity_id'] ?? '',
  52. 'owner_id' => $data['owner_id'] ?? '',
  53. 'source_bill' => $data['source_bill'] ?? '',
  54. 'unit_id' => $data['unit_id'] ?? '',
  55. 'sku' => $data['sku'] ?? '',
  56. 'barcode' => $data['barcode'] ?? '',
  57. 'work_name' => $data['work_name'] ?? '',
  58. ];
  59. }
  60. }