| 123456789101112131415161718192021222324252627282930313233343536373839 |
- <?php
- namespace App;
- use Illuminate\Database\Eloquent\Model;
- class OwnerPriceOperation extends Model
- {
- protected $fillable = [
- "operation_type", //操作类型
- "name", //名称
- "strategy", //策略
- "feature", //特征
- "remark", //备注
- "priority", //优先级 值越大越高
- ];
- public static $features = null;
- public static $columnMapping = null;
- public function ownerInStorageRule()
- { //入库规则
- return $this->hasOne(OwnerInStorageRule::class,"owner_price_operation_id","id");
- }
- public function ownerOutStorageRules()
- { //出库规则
- return $this->hasMany(OwnerOutStorageRule::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);
- }
- }
|