Skip to content

Commit 858080e

Browse files
authored
Merge pull request #3 from fallback/fix/migration_publishing_stub_rename
Fix migration file extension when publishing from Package
2 parents 49523c4 + 3d2255f commit 858080e

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/PackageServiceProvider.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
namespace Spatie\LaravelPackageTools;
55

66
use Illuminate\Support\ServiceProvider;
7+
use Illuminate\Support\Str;
78
use ReflectionClass;
89
use Spatie\LaravelPackageTools\Exceptions\InvalidPackage;
910

@@ -56,7 +57,7 @@ public function boot()
5657
foreach ($this->package->migrationFileNames as $migrationFileName) {
5758
if (! $this->migrationFileExists($migrationFileName)) {
5859
$this->publishes([
59-
$this->package->basePath("/../database/migrations/{$migrationFileName}.php.stub") => database_path('migrations/' . now()->format('Y_m_d_His') . '_' . $migrationFileName),
60+
$this->package->basePath("/../database/migrations/{$migrationFileName}.php.stub") => database_path('migrations/' . now()->format('Y_m_d_His') . '_' . Str::finish($migrationFileName, '.php')),
6061
], "{$this->package->name}-migrations");
6162
}
6263
}

tests/PackageServiceProviderTests/PackageMigrationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ public function it_can_publish_the_migration()
2323
->artisan('vendor:publish --tag=laravel-package-tools-migrations')
2424
->assertExitCode(0);
2525

26-
$this->assertFileExists(database_path('migrations/2020_01_01_000000_create_laravel_package_tools_table'));
26+
$this->assertFileExists(database_path('migrations/2020_01_01_000000_create_laravel_package_tools_table.php'));
2727
}
2828
}

0 commit comments

Comments
 (0)