1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-05 12:54:05 +00:00
This commit is contained in:
j.stein 2022-10-09 23:33:08 -04:00
parent 24f04c1328
commit a8f416dc1a
5 changed files with 5 additions and 24 deletions

View file

@ -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) {

View file

@ -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');
}

View file

@ -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;

View file

@ -47,7 +47,7 @@ class TenantList extends Command
*/
protected function domainsCli(Model $tenant): ?string
{
if (is_null($tenant->domains)){
if (! $tenant->domains) {
return null;
}

View file

@ -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"));