Skip to content

Commit 60ac213

Browse files
authored
Merge pull request #56 from iksaku/customizable_stubs
feature: Enable stub publishing and customization
2 parents 13e1d18 + a284391 commit 60ac213

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/Commands/Concerns/CanManipulateFiles.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ protected function copyStubToApp($stub, $targetPath, $replacements = [])
2424
{
2525
$filesystem = new Filesystem();
2626

27-
$stub = Str::of($filesystem->get(__DIR__ . "/../../../stubs/{$stub}.stub"));
27+
if (! $this->fileExists($stubPath = base_path("stubs/filament/{$stub}.stub"))) {
28+
$stubPath = __DIR__ . "/../../../stubs/{$stub}.stub";
29+
}
30+
31+
$stub = Str::of($filesystem->get($stubPath));
2832

2933
foreach ($replacements as $key => $replacement) {
3034
$stub = $stub->replace("{{ {$key} }}", $replacement);

src/FilamentServiceProvider.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,10 @@ protected function bootPublishing()
147147
__DIR__ . '/../resources/lang' => resource_path('lang/vendor/filament'),
148148
], 'filament-lang');
149149

150+
$this->publishes([
151+
__DIR__ . '/../stubs' => base_path('stubs/filament'),
152+
], 'filament-stubs');
153+
150154
$this->publishes([
151155
__DIR__ . '/../resources/views' => resource_path('views/vendor/filament'),
152156
], 'filament-views');

0 commit comments

Comments
 (0)