diff --git a/src/IgnitionServiceProvider.php b/src/IgnitionServiceProvider.php index bde5efca..de8f5c7b 100644 --- a/src/IgnitionServiceProvider.php +++ b/src/IgnitionServiceProvider.php @@ -43,6 +43,7 @@ use Facade\Ignition\SolutionProviders\DefaultDbNameSolutionProvider; use Facade\Ignition\SolutionProviders\MergeConflictSolutionProvider; use Facade\Ignition\SolutionProviders\MissingAppKeySolutionProvider; +use Facade\Ignition\SolutionProviders\MissingColumnSolutionProvider; use Facade\Ignition\SolutionProviders\MissingImportSolutionProvider; use Facade\Ignition\SolutionProviders\TableNotFoundSolutionProvider; use Illuminate\View\Engines\CompilerEngine as LaravelCompilerEngine; @@ -303,6 +304,7 @@ protected function getDefaultSolutions(): array InvalidRouteActionSolutionProvider::class, ViewNotFoundSolutionProvider::class, MergeConflictSolutionProvider::class, + MissingColumnSolutionProvider::class, ]; } diff --git a/src/SolutionProviders/MissingColumnSolutionProvider.php b/src/SolutionProviders/MissingColumnSolutionProvider.php new file mode 100644 index 00000000..bdacfdc2 --- /dev/null +++ b/src/SolutionProviders/MissingColumnSolutionProvider.php @@ -0,0 +1,35 @@ +isBadTableErrorCode($throwable->getCode()); + } + + protected function isBadTableErrorCode($code): bool + { + return $code === static::MYSQL_BAD_FIELD_CODE; + } + + public function getSolutions(Throwable $throwable): array + { + return [new RunMigrationsSolution('A column was not found')]; + } +} diff --git a/src/SolutionProviders/TableNotFoundSolutionProvider.php b/src/SolutionProviders/TableNotFoundSolutionProvider.php index 9ce2f4ba..ed8e20de 100644 --- a/src/SolutionProviders/TableNotFoundSolutionProvider.php +++ b/src/SolutionProviders/TableNotFoundSolutionProvider.php @@ -30,6 +30,6 @@ protected function isBadTableErrorCode($code): bool public function getSolutions(Throwable $throwable): array { - return [new RunMigrationsSolution()]; + return [new RunMigrationsSolution('A table was not found')]; } } diff --git a/src/Solutions/RunMigrationsSolution.php b/src/Solutions/RunMigrationsSolution.php index b1b96281..346ecc8f 100644 --- a/src/Solutions/RunMigrationsSolution.php +++ b/src/Solutions/RunMigrationsSolution.php @@ -7,9 +7,16 @@ class RunMigrationsSolution implements RunnableSolution { + private $customTitle; + + public function __construct($customTitle = '') + { + $this->customTitle = $customTitle; + } + public function getSolutionTitle(): string { - return 'A table was not found'; + return $this->customTitle; } public function getSolutionDescription(): string