diff --git a/src/Commands/Down.php b/src/Commands/Down.php index d79d2b20..40b77e3a 100644 --- a/src/Commands/Down.php +++ b/src/Commands/Down.php @@ -22,9 +22,6 @@ class Down extends DownCommand public function handle(): int { - // First we retrieve the compiled payload with all the - // parameters given, then for each tenant we will - // put down for maintenance and pass the payload. $payload = $this->getDownDatabasePayload(); tenancy()->runForMultiple($this->getTenants(), function ($tenant) use ($payload) { diff --git a/src/Commands/Install.php b/src/Commands/Install.php index ab03fa55..7b48fbc6 100644 --- a/src/Commands/Install.php +++ b/src/Commands/Install.php @@ -23,7 +23,6 @@ class Install extends Command ]); }); - $this->patienceIsKeyToLife(); $this->newLine(); if (!file_exists(base_path('routes/tenant.php'))) { @@ -38,7 +37,6 @@ class Install extends Command $this->components->warn('File [routes/tenant.php] already existe.'); } - $this->patienceIsKeyToLife(); $this->components->task('Publishing providers', function () { $this->callSilent('vendor:publish', [ @@ -47,7 +45,6 @@ class Install extends Command ]); }); - $this->patienceIsKeyToLife(); $this->newLine(); $this->components->task('Publishing migrations', function () { @@ -57,7 +54,6 @@ class Install extends Command ]); }); - $this->patienceIsKeyToLife(); $this->newLine(); if (!is_dir(database_path('migrations/tenant'))) { @@ -70,22 +66,11 @@ class Install extends Command $this->components->info('✨️ stancl/tenancy installed successfully.'); - $this->patienceIsKeyToLife(); $this->askForSupport(); return 0; } - /** - * Pause the console execution for 1 second, help the user to have time and read the output - * - * @return void - */ - public function patienceIsKeyToLife(): void - { - sleep(1); - } - /** * If the user accepts, opens the GitHub project in the browser * @@ -93,7 +78,7 @@ class Install extends Command */ public function askForSupport(): void { - if ($this->components->confirm("Would you like to show your support by starring the project on github ?", true)) { + if ($this->components->confirm("Would you like to show your support by starring the project on Github ?", true)) { if (PHP_OS_FAMILY === 'Darwin') { exec('open https://github.com/archtechx/tenancy'); } diff --git a/src/Commands/TenantDump.php b/src/Commands/TenantDump.php index b42d2b68..bbdf3939 100644 --- a/src/Commands/TenantDump.php +++ b/src/Commands/TenantDump.php @@ -31,7 +31,7 @@ class TenantDump extends DumpCommand $tenant = tenancy()->find($tenant); } - if (is_null($tenant)){ + if ($tenant === null) { $this->components->error("Could not find tenant to use for dumping the schema."); return 1; diff --git a/src/Commands/TenantList.php b/src/Commands/TenantList.php index 15f362a8..6e23b995 100644 --- a/src/Commands/TenantList.php +++ b/src/Commands/TenantList.php @@ -47,7 +47,7 @@ class TenantList extends Command */ protected function domainsCli(Model $tenant): ?string { - if (is_null($tenant->domains)){ + if (! $tenant->domains) { return null; } diff --git a/tests/CommandsTest.php b/tests/CommandsTest.php index 05b6c0b1..60fcd0c6 100644 --- a/tests/CommandsTest.php +++ b/tests/CommandsTest.php @@ -168,7 +168,7 @@ test('install command works', function () { } pest()->artisan('tenancy:install') - ->expectsConfirmation('Would you like to show your support by starring the project on github ?', 'no') + ->expectsConfirmation('Would you like to show your support by starring the project on Github ?', 'no') ->assertExitCode(0); expect(base_path('routes/tenant.php'))->toBeFile(); expect(base_path('config/tenancy.php'))->toBeFile(); @@ -223,8 +223,7 @@ test('link command works', function() { pest()->artisan('tenants:link', [ '--remove' => true, - ]) - ->assertExitCode(0); + ])->assertExitCode(0); $this->assertDirectoryDoesNotExist(public_path("public-$tenantId1")); $this->assertDirectoryDoesNotExist(public_path("public-$tenantId2"));