RuleLog.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Builder;
  4. use Illuminate\Database\Eloquent\Model;
  5. use Illuminate\Database\Eloquent\Relations\HasOne;
  6. /**
  7. * 触发审计规则日志
  8. *
  9. * @property int $id
  10. * @property int $user_id 用户ID
  11. * @property int $node_id 节点ID
  12. * @property int $rule_id 规则ID,0表示白名单模式下访问访问了非规则允许的网址
  13. * @property string $reason 触发原因
  14. * @property \Illuminate\Support\Carbon $created_at 创建时间
  15. * @property-read \App\Models\Node|null $node
  16. * @property-read \App\Models\Rule|null $rule
  17. * @property-read \App\Models\User|null $user
  18. * @method static Builder|RuleLog newModelQuery()
  19. * @method static Builder|RuleLog newQuery()
  20. * @method static Builder|RuleLog query()
  21. * @method static Builder|RuleLog whereCreatedAt($value)
  22. * @method static Builder|RuleLog whereId($value)
  23. * @method static Builder|RuleLog whereNodeId($value)
  24. * @method static Builder|RuleLog whereReason($value)
  25. * @method static Builder|RuleLog whereRuleId($value)
  26. * @method static Builder|RuleLog whereUserId($value)
  27. * @mixin \Eloquent
  28. */
  29. class RuleLog extends Model {
  30. const UPDATED_AT = null;
  31. protected $table = 'rule_log';
  32. public function user(): HasOne {
  33. return $this->hasOne(User::class, 'id', 'user_id');
  34. }
  35. public function node(): HasOne {
  36. return $this->hasOne(Node::class, 'id', 'node_id');
  37. }
  38. public function rule(): HasOne {
  39. return $this->hasOne(Rule::class, 'id', 'rule_id');
  40. }
  41. }