| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- <?php
- namespace App;
- use Illuminate\Database\Eloquent\Model;
- use App\Traits\ModelLogChanging;
- use Illuminate\Database\Eloquent\Relations\BelongsTo;
- class OwnerStoreFeeDetail extends Model
- {
- use ModelLogChanging;
- public $fillable = [
- 'owner_fee_detail_id',
- 'unit_id',
- 'unit_price', //单价
- 'amount', //数量
- 'owner_id', //货主
- 'fee',//费用
- 'commodity_id',
- 'packing_material_fee',//包材费
- 'tax_fee',//税费
- 'sku',//sku
- 'barcode',//条码
- 'work_name',//作业名称
- 'asn_code',//asn号
- ];
- public function ownerFeeDetail(): BelongsTo
- {
- return $this->belongsTo(OwnerFeeDetail::class);
- }
- public function unit(): BelongsTo
- {
- return $this->belongsTo(Unit::class);
- }
- public function getPriceAttribute(): string
- {
- return $this->unit_price . '/' . $this->unit->name;
- }
- public function owner(): BelongsTo
- {
- return $this->belongsTo(Owner::class);
- }
- public function commodity(): BelongsTo
- {
- return $this->belongsTo(Commodity::class);
- }
- /**
- * 根据参数条件删除
- * @param $data
- */
- public static function uDelete($data)
- {
- self::query()
- ->where('owner_fee_detail_id', $data['owner_fee_detail_id'])
- ->where('unit_id', $data['unit_id'])
- ->where('owner_id', $data['owner_id'])
- ->where('commodity_id', $data['commodity_id'])
- ->where('sku', $data['sku'])
- ->where('barcode', $data['barcode'])
- ->where('work_name', $data['work_name'])
- ->where('asn_code', $data['asn_code'])
- ->delete();
- }
- }
|