Skip to content

Commit

Permalink
fix: alternative for FreshCommand migrator argument
Browse files Browse the repository at this point in the history
  • Loading branch information
SRWieZ committed Dec 12, 2024
1 parent 8fb93e9 commit cac9ea1
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/NativeServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,14 @@ public function packageRegistered()
{
$this->mergeConfigFrom($this->package->basePath('/../config/nativephp-internal.php'), 'nativephp-internal');

$this->app->singleton(FreshCommand::class, function () {
return new FreshCommand;
$this->app->singleton(FreshCommand::class, function ($app) {

// if Laravel 11 or higher, send the migrator instance to the FreshCommand
if (version_compare($app->version(), '11.0.0', '>=')) {
return new FreshCommand($app['migrator']);
}

return new FreshCommand();
});

$this->app->singleton(MigrateCommand::class, function ($app) {
Expand Down

0 comments on commit cac9ea1

Please sign in to comment.