RuleGroup.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Builder;
  4. use Illuminate\Database\Eloquent\Model;
  5. /**
  6. * 审计规则分组
  7. *
  8. * @property int $id
  9. * @property int|null $type 模式:1-阻断、2-仅放行
  10. * @property string|null $name 分组名称
  11. * @property string|null $rules 关联的规则ID,多个用,号分隔
  12. * @property string|null $nodes 关联的节点ID,多个用,号分隔
  13. * @property \Illuminate\Support\Carbon|null $created_at
  14. * @property \Illuminate\Support\Carbon|null $updated_at
  15. * @property-read mixed $type_label
  16. * @method static Builder|RuleGroup newModelQuery()
  17. * @method static Builder|RuleGroup newQuery()
  18. * @method static Builder|RuleGroup query()
  19. * @method static Builder|RuleGroup whereCreatedAt($value)
  20. * @method static Builder|RuleGroup whereId($value)
  21. * @method static Builder|RuleGroup whereName($value)
  22. * @method static Builder|RuleGroup whereNodes($value)
  23. * @method static Builder|RuleGroup whereRules($value)
  24. * @method static Builder|RuleGroup whereType($value)
  25. * @method static Builder|RuleGroup whereUpdatedAt($value)
  26. * @mixin \Eloquent
  27. */
  28. class RuleGroup extends Model {
  29. protected $table = 'rule_group';
  30. protected $primaryKey = 'id';
  31. function getTypeLabelAttribute() {
  32. if($this->attributes['type']){
  33. $type_label = '<span class="badge badge-danger">阻 断</span>';
  34. }else{
  35. $type_label = '<span class="badge badge-primary">放 行</span>';
  36. }
  37. return $type_label;
  38. }
  39. }