RuleGroup.php 579 B

123456789101112131415161718192021222324252627282930
  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 = [
  11. 'rules' => 'array',
  12. 'nodes' => 'array',
  13. ];
  14. public function getTypeLabelAttribute(): string
  15. {
  16. if ($this->attributes['type']) {
  17. $type_label = '<span class="badge badge-danger">阻 断</span>';
  18. } else {
  19. $type_label = '<span class="badge badge-primary">放 行</span>';
  20. }
  21. return $type_label;
  22. }
  23. }