From 413b7d83e1a104aa737226741e5a0d10ab8d97d1 Mon Sep 17 00:00:00 2001 From: zyimm Date: Wed, 1 Feb 2023 10:15:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=91=BD=E5=90=8D=E7=A9=BA=E9=97=B4=E5=86=B2?= =?UTF-8?q?=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/command/Migrate.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/command/Migrate.php b/src/command/Migrate.php index fb4e183..ddf47e3 100644 --- a/src/command/Migrate.php +++ b/src/command/Migrate.php @@ -140,12 +140,14 @@ abstract class Migrate extends Command $fileNames[$class] = basename($filePath); // load the migration file - /** @noinspection PhpIncludeInspection */ require_once $filePath; if (!class_exists($class)) { - throw new InvalidArgumentException(sprintf('Could not find class "%s" in file "%s"', $class, $filePath)); + if (!class_exists('database\\migrations\\' . $class)) { + throw new InvalidArgumentException(sprintf('Could not find class "%s" in file "%s"', $class, $filePath)); + } else { + $class = 'database\\migrations\\' . $class; + } } - // instantiate it $migration = new $class($version, $this->input, $this->output);