OwnerStoreOutFeeDetail.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. 'packingMaterialFee',//耗材费
  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. */
  46. public static function uDelete($data)
  47. {
  48. self::query()
  49. ->where('owner_fee_detail_id',$data['owner_fee_detail_id'])
  50. ->where('commodity_id',$data['commodity_id'])
  51. ->where('owner_id',$data['owner_id'])
  52. ->where('source_bill',$data['source_bill'])
  53. ->where('unit_id',$data['unit_id'])
  54. ->where('sku',$data['sku'])
  55. ->where('barcode',$data['barcode'])
  56. ->where('work_name',$data['work_name'])
  57. ->delete();
  58. }
  59. }