RuleGroup.php 588 B

1234567891011121314151617181920212223242526
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Model;
  4. /**
  5. * 审计规则分组.
  6. */
  7. class RuleGroup extends Model
  8. {
  9. protected $table = 'rule_group';
  10. protected $casts = ['rules' => 'array', 'nodes' => 'array'];
  11. protected $guarded = ['id'];
  12. public function getTypeLabelAttribute(): string
  13. {
  14. if ($this->attributes['type']) {
  15. $type_label = '<span class="badge badge-danger">阻 断</span>';
  16. } else {
  17. $type_label = '<span class="badge badge-primary">放 行</span>';
  18. }
  19. return $type_label;
  20. }
  21. }