model = new OpmDsSensor; } public static function new(): SensorRepository { return new self(); } /** * 根据ID查找传感器 * @throws EntityNotFoundException */ public function findOrFail(int $id): OpmDsSensor { $sensor = $this->scopedQuery()->find($id); if (!$sensor) { throw new EntityNotFoundException('传感器不存在'); } return $sensor; } }