OwnerPriceOperationItem.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace App;
  3. use Illuminate\Database\Eloquent\Model;
  4. use App\Traits\ModelLogChanging;
  5. class OwnerPriceOperationItem extends Model
  6. {
  7. use ModelLogChanging;
  8. protected $fillable = [
  9. "owner_price_operation_id", //作业计费ID
  10. "strategy", //子策略
  11. "amount", //起步数
  12. "unit_id", //单位ID
  13. "unit_price", //单价
  14. "feature", //特征
  15. "priority", //优先级 值越大越高
  16. "discount_price", //减免单价
  17. ];
  18. public $timestamps=false;
  19. public static $features = null;
  20. public static $columnMapping = null;
  21. public function unit()
  22. { //单位
  23. return $this->hasOne(Unit::class,"id","unit_id");
  24. }
  25. /* 格式化依据静态参数,在调用前设置 */
  26. public function getFeatureFormatAttribute()
  27. {
  28. if ($this->strategy == '默认')return "/";
  29. return app("FeatureService")->formatFeature(self::$features,$this->feature,self::$columnMapping);
  30. }
  31. }