model = new OpmDsDevice; } public static function new(): DeviceRepository { return new self(); } /** * 根据ID查找设备 * @throws EntityNotFoundException */ public function findOrFail(int $id): OpmDsDevice { $device = $this->scopedQuery()->find($id); if (!$device) { throw new EntityNotFoundException('设备不存在'); } return $device; } }