Skip to content

Commit

Permalink
Update install command for Laravel 11
Browse files Browse the repository at this point in the history
  • Loading branch information
askdkc committed Jan 16, 2024
1 parent aa55527 commit 5956821
Showing 1 changed file with 59 additions and 24 deletions.
83 changes: 59 additions & 24 deletions src/Commands/BreezejpCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,36 +25,71 @@ public function handle(): int
(new Filesystem)->ensureDirectoryExists(lang_path());
(new Filesystem)->copyDirectory(__DIR__.'/../../stubs/lang/', lang_path());

$this->info('config/app.phpのlocaleをjaにします');
// Read the contents of the file into a string
$configfile = file_get_contents(base_path('config/app.php'));
if (file_exists(base_path("config/app.php"))) {
$this->info('config/app.phpのlocaleをjaにします');
// Read the contents of the file into a string
$configfile = file_get_contents(base_path('config/app.php'));

// Modify the contents of the string
$configfile = str_replace("'locale' => 'en'", "'locale' => 'ja'", $configfile);
$configfile = str_replace("'faker_locale' => 'en_US'", "'faker_locale' => 'ja_JP'", $configfile);
$configfile = str_replace("'timezone' => 'UTC'", "'timezone' => 'Asia/Tokyo'", $configfile);

// Save the modified contents back to the file
file_put_contents(base_path('config/app.php'), $configfile);

if ($this->confirm('GitHubリポジトリにスターの御協力をお願いします🙏', true)) {
$repoUrl = 'https://github.com/askdkc/breezejp';

if (PHP_OS_FAMILY == 'Darwin') {
exec("open {$repoUrl}");
}
if (PHP_OS_FAMILY == 'Windows') {
exec("start {$repoUrl}");
}
if (PHP_OS_FAMILY == 'Linux') {
exec("xdg-open {$repoUrl}");
}

$this->line('Thank you! / ありがとう💓');
}

// Modify the contents of the string
$configfile = str_replace("'locale' => 'en'", "'locale' => 'ja'", $configfile);
$configfile = str_replace("'faker_locale' => 'en_US'", "'faker_locale' => 'ja_JP'", $configfile);
$configfile = str_replace("'timezone' => 'UTC'", "'timezone' => 'Asia/Tokyo'", $configfile);
$this->info('日本語ファイルのインストールが完了しました!');

// Save the modified contents back to the file
file_put_contents(base_path('config/app.php'), $configfile);
return self::SUCCESS;

if ($this->confirm('GitHubリポジトリにスターの御協力をお願いします🙏', true)) {
$repoUrl = 'https://github.com/askdkc/breezejp';
}

if (PHP_OS_FAMILY == 'Darwin') {
exec("open {$repoUrl}");
}
if (PHP_OS_FAMILY == 'Windows') {
exec("start {$repoUrl}");
}
if (PHP_OS_FAMILY == 'Linux') {
exec("xdg-open {$repoUrl}");
}

$this->line('Thank you! / ありがとう💓');
}
// For Laravel 11 and above
$this->info('.envのlocaleをjaにします');
// Read the contents of the file into a string
$configfile = file_get_contents(base_path('.env'));

$this->info('日本語ファイルのインストールが完了しました!');
// Modify the contents of the string
$configfile = str_replace("'locale' => 'en'", "'locale' => 'ja'", $configfile);
$configfile = str_replace("'faker_locale' => 'en_US'", "'faker_locale' => 'ja_JP'", $configfile);
$configfile = str_replace("'timezone' => 'UTC'", "'timezone' => 'Asia/Tokyo'", $configfile);

// Save the modified contents back to the file
file_put_contents(base_path('.env'), $configfile);

if ($this->confirm('GitHubリポジトリにスターの御協力をお願いします🙏', true)) {

Check failure on line 77 in src/Commands/BreezejpCommand.php

View workflow job for this annotation

GitHub Actions / phpstan

Method Askdkc\Breezejp\Commands\BreezejpCommand::handle() should return int but return statement is missing.
$repoUrl = 'https://github.com/askdkc/breezejp';

if (PHP_OS_FAMILY == 'Darwin') {
exec("open {$repoUrl}");
}
if (PHP_OS_FAMILY == 'Windows') {
exec("start {$repoUrl}");
}
if (PHP_OS_FAMILY == 'Linux') {
exec("xdg-open {$repoUrl}");
}

$this->line('Thank you! / ありがとう💓');
}

return self::SUCCESS;

}
}

0 comments on commit 5956821

Please sign in to comment.