Skip to content

Commit 709424e

Browse files
authored
Fix migrationFileExists function
Because you have on line 59 variable $migrationFileName without .php and you set it: ``` $this->package->basePath("/../database/migrations/{$migrationFileName}.php.stub") => database_path('migrations/' . now()->format('Y_m_d_His') . '_' . Str::finish($migrationFileName, '.php')), ``` so you must check existing migrations (function migrationFileExists) with .php extension too. If you don't do that, condition can not work properly, e.g. current functionality return false _te_users_table.php === create_users_table_. This pull request fix this condition and it will return true __create_users_table.php === create_users_table.php_.
1 parent e9f79b6 commit 709424e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/PackageServiceProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,10 @@ public function boot()
9898

9999
public static function migrationFileExists(string $migrationFileName): bool
100100
{
101-
$len = strlen($migrationFileName);
101+
$len = strlen($migrationFileName) + 4;
102102

103103
foreach (glob(database_path("migrations/*.php")) as $filename) {
104-
if ((substr($filename, -$len) === $migrationFileName)) {
104+
if ((substr($filename, -$len) === $migrationFileName . '.php')) {
105105
return true;
106106
}
107107
}

0 commit comments

Comments
 (0)