model = new OpmDsWarnRule; } public static function new(): WarnRuleRepository { return new self(); } /** * 根据ID查找报警规则 * @throws EntityNotFoundException */ public function findOrFail(int $id): OpmDsWarnRule { $rule = $this->scopedQuery()->find($id); if (!$rule) { throw new EntityNotFoundException('报警规则不存在'); } return $rule; } }