| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <?php
- namespace App;
- use Illuminate\Database\Eloquent\Model;
- use App\Traits\ModelLogChanging;
- class OwnerPriceOperationItem extends Model
- {
- use ModelLogChanging;
- protected $fillable = [
- "owner_price_operation_id", //作业计费ID
- "strategy", //子策略
- "amount", //起步数
- "unit_id", //单位ID
- "unit_price", //单价
- "feature", //特征
- "priority", //优先级 值越大越高
- "discount_price", //减免单价
- "odd_price", //零头价
- ];
- public $timestamps=false;
- public static $features = null;
- public static $columnMapping = null;
- public function unit()
- { //单位
- return $this->belongsTo(Unit::class);
- }
- public function ownerPriceOperation()
- { //作业计费
- return $this->belongsTo(OwnerPriceOperation::class,"owner_price_operation_id","id");
- }
- /* 格式化依据静态参数,在调用前设置 */
- public function getFeatureFormatAttribute()
- {
- if ($this->strategy == '默认')return "/";
- return app("FeatureService")->formatFeature(self::$features,$this->feature,self::$columnMapping);
- }
- }
|