Files
zimoyin 13fd9c5f0a init
2026-04-06 20:48:32 +08:00

33 lines
722 B
PHP

<?php
namespace plugin\admin\app\repository;
use plugin\admin\app\model\OpmDsWarnRule;
use plugin\admin\app\repository\exception\EntityNotFoundException;
class WarnRuleRepository extends BaseRepository
{
public function __construct()
{
$this->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;
}
}