From 36df61b79b07056c08bcebb8029f28a4deea4784 Mon Sep 17 00:00:00 2001 From: Tobias Oitzinger Date: Fri, 1 Dec 2023 20:20:15 +0100 Subject: [PATCH 1/3] Make migrations publishable Signed-off-by: Tobias Oitzinger --- src/PulseServiceProvider.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/PulseServiceProvider.php b/src/PulseServiceProvider.php index 17e15089..f502879b 100644 --- a/src/PulseServiceProvider.php +++ b/src/PulseServiceProvider.php @@ -215,6 +215,10 @@ protected function registerPublishing(): void $this->publishes([ __DIR__.'/../resources/views/dashboard.blade.php' => resource_path('views/vendor/pulse/dashboard.blade.php'), ], ['pulse', 'pulse-dashboard']); + + $this->publishes([ + __DIR__.'/../database/migrations' => database_path('migrations'), + ], 'pulse-migrations'); } } From 3bf6db57f73cac8b920a0b418f77a34aaeecd8c2 Mon Sep 17 00:00:00 2001 From: Tim MacDonald Date: Tue, 5 Dec 2023 16:12:28 +1100 Subject: [PATCH 2/3] Remove implicit migration helpers --- src/Facades/Pulse.php | 2 -- src/Pulse.php | 21 --------------------- src/PulseServiceProvider.php | 16 +--------------- tests/TestCase.php | 1 + 4 files changed, 2 insertions(+), 38 deletions(-) diff --git a/src/Facades/Pulse.php b/src/Facades/Pulse.php index 1393f1ee..6471aaa4 100644 --- a/src/Facades/Pulse.php +++ b/src/Facades/Pulse.php @@ -26,8 +26,6 @@ * @method static \Laravel\Pulse\Pulse rememberUser(\Illuminate\Contracts\Auth\Authenticatable $user) * @method static string css() * @method static string js() - * @method static bool runsMigrations() - * @method static \Laravel\Pulse\Pulse ignoreMigrations() * @method static bool registersRoutes() * @method static \Laravel\Pulse\Pulse ignoreRoutes() * @method static \Laravel\Pulse\Pulse handleExceptionsUsing(callable $callback) diff --git a/src/Pulse.php b/src/Pulse.php index ab9f5716..6eb741ac 100644 --- a/src/Pulse.php +++ b/src/Pulse.php @@ -77,10 +77,6 @@ class Pulse */ protected int|string|null $rememberedUserId = null; - /** - * Indicates if Pulse migrations will be run. - */ - protected bool $runsMigrations = true; /** * Indicates if Pulse routes will be registered. @@ -456,23 +452,6 @@ public function js(): string return $content; } - /** - * Determine if Pulse may run migrations. - */ - public function runsMigrations(): bool - { - return $this->runsMigrations; - } - - /** - * Configure Pulse to not register its migrations. - */ - public function ignoreMigrations(): self - { - $this->runsMigrations = false; - - return $this; - } /** * Determine if Pulse may register routes. diff --git a/src/PulseServiceProvider.php b/src/PulseServiceProvider.php index f502879b..fc3269a8 100644 --- a/src/PulseServiceProvider.php +++ b/src/PulseServiceProvider.php @@ -8,7 +8,6 @@ use Illuminate\Contracts\Events\Dispatcher; use Illuminate\Contracts\Foundation\Application; use Illuminate\Contracts\Http\Kernel as HttpKernel; -use Illuminate\Database\Migrations\Migrator; use Illuminate\Queue\Events\Looping; use Illuminate\Queue\Events\WorkerStopping; use Illuminate\Routing\Router; @@ -75,7 +74,6 @@ public function boot(): void $this->listenForEvents(); $this->registerComponents(); $this->registerResources(); - $this->registerMigrations(); $this->registerPublishing(); $this->registerCommands(); } @@ -190,18 +188,6 @@ protected function registerResources(): void $this->loadViewsFrom(__DIR__.'/../resources/views', 'pulse'); } - /** - * Register the package's migrations. - */ - protected function registerMigrations(): void - { - $this->callAfterResolving('migrator', function (Migrator $migrator, Application $app) { - if ($app->make(Pulse::class)->runsMigrations()) { - $migrator->path(__DIR__.'/../database/migrations'); - } - }); - } - /** * Register the package's publishable resources. */ @@ -218,7 +204,7 @@ protected function registerPublishing(): void $this->publishes([ __DIR__.'/../database/migrations' => database_path('migrations'), - ], 'pulse-migrations'); + ], ['pulse', 'pulse-migrations']); } } diff --git a/tests/TestCase.php b/tests/TestCase.php index 08867bda..4dfb0310 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -21,6 +21,7 @@ protected function getPackageProviders($app): array protected function defineDatabaseMigrations(): void { + $this->loadMigrationsFrom(__DIR__.'/../database/migrations'); $this->loadMigrationsFrom(__DIR__.'/migrations'); } From 3bcb9628ce2966f08f88795f378172192a316a97 Mon Sep 17 00:00:00 2001 From: Tim MacDonald Date: Wed, 6 Dec 2023 09:22:28 +1100 Subject: [PATCH 3/3] Remove migration methods --- src/Pulse.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Pulse.php b/src/Pulse.php index 6eb741ac..696bb721 100644 --- a/src/Pulse.php +++ b/src/Pulse.php @@ -77,7 +77,6 @@ class Pulse */ protected int|string|null $rememberedUserId = null; - /** * Indicates if Pulse routes will be registered. */ @@ -452,7 +451,6 @@ public function js(): string return $content; } - /** * Determine if Pulse may register routes. */