OwnerPriceOperationItem.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. "odd_price", //零头价
  18. ];
  19. public $timestamps=false;
  20. public static $features = null;
  21. public static $columnMapping = null;
  22. public function unit()
  23. { //单位
  24. return $this->belongsTo(Unit::class);
  25. }
  26. public function ownerPriceOperation()
  27. { //作业计费
  28. return $this->belongsTo(OwnerPriceOperation::class,"owner_price_operation_id","id");
  29. }
  30. /* 格式化依据静态参数,在调用前设置 */
  31. public function getFeatureFormatAttribute()
  32. {
  33. if ($this->strategy == '默认')return "/";
  34. return app("FeatureService")->formatFeature(self::$features,$this->feature,self::$columnMapping);
  35. }
  36. }