| 1234567891011121314151617181920212223242526272829303132333435363738 |
- <?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", //优先级 值越大越高
- ];
- 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);
- }
- }
|