-
-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cc12e4c
commit 86f2e84
Showing
13 changed files
with
145 additions
and
262 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,22 @@ | ||
/.idea | ||
/.vscode | ||
/docker/8.1 | ||
/node_modules | ||
/public/build | ||
/public/hot | ||
/public/storage | ||
/storage/*.key | ||
/storage/logs | ||
/vendor | ||
config.yml | ||
_ide_helper.php | ||
.env | ||
.env.backup | ||
.phpstorm.meta.php | ||
.phpunit.result.cache | ||
config.yml | ||
auth.json | ||
docker-compose.yml | ||
Homestead.json | ||
Homestead.yaml | ||
auth.json | ||
npm-debug.log | ||
yarn-error.log | ||
/.idea | ||
/.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
<?php | ||
|
||
namespace App\Console\Commands; | ||
|
||
use Illuminate\Console\Command; | ||
use Illuminate\Support\Facades\Artisan; | ||
|
||
class InstallCommand extends Command | ||
{ | ||
/** | ||
* The name and signature of the console command. | ||
* | ||
* @var string | ||
*/ | ||
protected $signature = 'app:install {--force}'; | ||
|
||
/** | ||
* The console command description. | ||
* | ||
* @var string | ||
*/ | ||
protected $description = 'A fresh install of Speedtest Tracker.'; | ||
|
||
/** | ||
* Execute the console command. | ||
* | ||
* @return int | ||
*/ | ||
public function handle() | ||
{ | ||
if (! $this->option('force')) { | ||
$this->newLine(2); | ||
|
||
$this->info("Running the install will reset all of the application's data."); | ||
$this->warn('!!! ALL OF THE DATA WILL BE DELETED !!!'); | ||
|
||
if (! $this->confirm('Do you wish to continue?')) { | ||
$this->info('Install cancelled.'); | ||
|
||
return 0; | ||
} | ||
} | ||
|
||
$this->info('Starting to install the application...'); | ||
|
||
$this->newLine(); | ||
|
||
$this->checkAppKey(); | ||
|
||
$this->line('⏳ Optimizing the cache'); | ||
|
||
Artisan::call('optimize:clear'); | ||
|
||
$this->line('✅ Optimized cache'); | ||
|
||
$this->newLine(); | ||
|
||
$this->line('⏳ Migrating the database'); | ||
|
||
try { | ||
Artisan::call('migrate:fresh', [ | ||
'--force' => true, | ||
]); | ||
} catch (\Throwable $th) { | ||
$this->error('❌ There was an issue migrating the database, check the logs.'); | ||
|
||
return 0; | ||
} | ||
|
||
$this->line('✅ Database migrated'); | ||
|
||
$this->newLine(); | ||
|
||
$this->line('🚀 Finished installing the application!'); | ||
|
||
return 0; | ||
} | ||
|
||
public function checkAppKey() | ||
{ | ||
if (empty(config('app.key'))) { | ||
$this->line('🔑 Creating an application key'); | ||
|
||
Artisan::call('key:generate'); | ||
|
||
$this->line('✅ Application key created'); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.