OwnerLogisticFeeDetail.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. namespace App;
  3. use Illuminate\Database\Eloquent\Model;
  4. use App\Traits\ModelLogChanging;
  5. use Illuminate\Database\Eloquent\Relations\BelongsTo;
  6. use Illuminate\Database\Eloquent\Relations\HasOne;
  7. class OwnerLogisticFeeDetail extends Model
  8. {
  9. use ModelLogChanging;
  10. public $fillable = [
  11. 'owner_fee_detail_id', //
  12. 'logistic_bill',//快递单号
  13. 'initial_weight',//首重
  14. 'initial_weight_price',//首重价格
  15. 'additional_weight',//续重
  16. 'additional_price',//续重价格
  17. 'logistic_id',//承运商
  18. 'owner_id',//货主
  19. 'additional_weigh_weight',//续重重量
  20. 'tax_fee',//税费
  21. 'fee'//费用
  22. ];
  23. public function ownerFeeDetail(): BelongsTo
  24. {
  25. return $this->belongsTo(OwnerFeeDetail::class);
  26. }
  27. public function ownerFeeDetailLogistic(): BelongsTo
  28. {
  29. return $this->belongsTo(OwnerFeeDetailLogistic::class, 'logistic_bill', 'logistic_bill');
  30. }
  31. public function logistic(): BelongsTo
  32. {
  33. return $this->belongsTo(Logistic::class);
  34. }
  35. /**
  36. * 根据参数条件删除
  37. * @param $data
  38. */
  39. public static function uDelete($data)
  40. {
  41. self::query()
  42. ->where('owner_fee_detail_id', $data['owner_fee_detail_id'])
  43. ->where('logistic_bill', $data['logistic_bill'])
  44. ->where('initial_weight', $data['initial_weight'])
  45. ->where('additional_weight', $data['additional_weight'])
  46. ->where('logistic_id', $data['logistic_id'])
  47. ->where('owner_id', $data['owner_id'])
  48. ->where('additional_weigh_weight', $data['additional_weigh_weight'])
  49. ->delete();
  50. }
  51. }