| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- <?php
- namespace App;
- use Illuminate\Database\Eloquent\Model;
- use App\Traits\LogModelChanging;
- class OwnerPriceOperation extends Model
- {
- use LogModelChanging;
- protected $fillable = [
- "operation_type", //操作类型
- "name", //名称
- "strategy", //策略
- "feature", //特征
- "remark", //备注
- "priority", //优先级 值越大越高
- "discount_count", //减免值
- "total_price", //按单计价
- ];
- public static $features = null;
- public static $columnMapping = null;
- public function items()
- { //出库规则
- return $this->hasMany(OwnerPriceOperationItem::class,"owner_price_operation_id","id");
- }
- public function ownerPriceOperationOwners()
- { //货主
- return $this->belongsToMany(Owner::class,"owner_price_operation_owner","owner_price_operation_id","owner_id");
- }
- public function getFeatureFormatAttribute()
- {
- if ($this->strategy == '默认')return "/";
- return app("FeatureService")->formatFeature(self::$features,$this->feature,self::$columnMapping);
- }
- }
|