1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-05 17:34:03 +00:00

fix typos, improve code

This commit is contained in:
Samuel Štancl 2022-10-18 17:30:12 +02:00 committed by GitHub
parent bceda97de2
commit 64d1daf93a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -10,13 +10,13 @@ class Install extends Command
{ {
protected $signature = 'tenancy:install'; protected $signature = 'tenancy:install';
protected $description = 'Install stancl/tenancy.'; protected $description = 'Install Tenancy for Laravel.';
public function handle(): int public function handle(): int
{ {
$this->newLine(); $this->newLine();
$this->components->task('Publishing config file', function () { $this->components->task('Publishing config file [config/tenancy.php]', function () {
$this->callSilent('vendor:publish', [ $this->callSilent('vendor:publish', [
'--provider' => 'Stancl\Tenancy\TenancyServiceProvider', '--provider' => 'Stancl\Tenancy\TenancyServiceProvider',
'--tag' => 'config', '--tag' => 'config',
@ -25,8 +25,8 @@ class Install extends Command
$this->newLine(); $this->newLine();
if (!file_exists(base_path('routes/tenant.php'))) { if (! file_exists(base_path('routes/tenant.php'))) {
$this->components->task('Publishing routes', function () { $this->components->task('Publishing routes [routes/tenant.php]', function () {
$this->callSilent('vendor:publish', [ $this->callSilent('vendor:publish', [
'--provider' => 'Stancl\Tenancy\TenancyServiceProvider', '--provider' => 'Stancl\Tenancy\TenancyServiceProvider',
'--tag' => 'routes', '--tag' => 'routes',
@ -34,11 +34,10 @@ class Install extends Command
}); });
$this->newLine(); $this->newLine();
} else { } else {
$this->components->warn('File [routes/tenant.php] already existe.'); $this->components->warn('File [routes/tenant.php] already exists.');
} }
$this->components->task('Publishing service provider [app/Providers/TenancyServiceProvider.php]', function () {
$this->components->task('Publishing providers', function () {
$this->callSilent('vendor:publish', [ $this->callSilent('vendor:publish', [
'--provider' => 'Stancl\Tenancy\TenancyServiceProvider', '--provider' => 'Stancl\Tenancy\TenancyServiceProvider',
'--tag' => 'providers', '--tag' => 'providers',
@ -56,29 +55,25 @@ class Install extends Command
$this->newLine(); $this->newLine();
if (!is_dir(database_path('migrations/tenant'))) { if (! is_dir(database_path('migrations/tenant'))) {
$this->components->task('Creating database/migrations/tenant folder', function () { $this->components->task('Creating [database/migrations/tenant] folder', function () {
mkdir(database_path('migrations/tenant')); mkdir(database_path('migrations/tenant'));
}); });
} else { } else {
$this->components->warn('Folder [database/migrations/tenant] already existe.'); $this->components->warn('Folder [database/migrations/tenant] already exists.');
} }
$this->components->info('✨️ stancl/tenancy installed successfully.'); $this->components->info('✨️ Tenancy for Laravel successfully installed.');
$this->askForSupport(); $this->askForSupport();
return 0; return 0;
} }
/** /** If the user accepts, opens the GitHub project in the browser. */
* If the user accepts, opens the GitHub project in the browser
*
* @return void
*/
public function askForSupport(): void 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') { if (PHP_OS_FAMILY === 'Darwin') {
exec('open https://github.com/archtechx/tenancy'); exec('open https://github.com/archtechx/tenancy');
} }