-
-
Notifications
You must be signed in to change notification settings - Fork 71
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
9a73e08
commit f3e53d7
Showing
5 changed files
with
147 additions
and
33 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 |
---|---|---|
@@ -0,0 +1,92 @@ | ||
<?php | ||
|
||
namespace App\Console\Commands; | ||
|
||
use App\Models\User; | ||
use Illuminate\Console\Command; | ||
|
||
class InstallCommand extends Command | ||
{ | ||
/** | ||
* The name and signature of the console command. | ||
* | ||
* @var string | ||
*/ | ||
protected $signature = 'finance:install'; | ||
|
||
/** | ||
* The console command description. | ||
* | ||
* @var string | ||
*/ | ||
protected $description = 'Init the finance app'; | ||
|
||
/** | ||
* Create a new command instance. | ||
* | ||
* @return void | ||
*/ | ||
public function __construct() | ||
{ | ||
parent::__construct(); | ||
} | ||
|
||
/** | ||
* Execute the console command. | ||
* | ||
* @return int | ||
*/ | ||
public function handle() | ||
{ | ||
$this->writeLogo(); | ||
|
||
$name = $this->ask('What is your name?'); | ||
$email = $this->ask('What is your email address?'); | ||
$password = $this->secret('Please provide a new password'); | ||
|
||
if(empty($name) || empty($email) || empty($password)) { | ||
$this->line("<options=bold,reverse;fg=red> WHOOPS </> 😳 \n"); | ||
$this->error('Please provide the required information!'); | ||
return; | ||
} | ||
|
||
if ($this->confirm('Do you wish to generate the default brands and categories?', true)) { | ||
$this->call('db:seed'); | ||
} | ||
|
||
User::create(['name' => $name, 'email' => $email, 'password' => bcrypt($password)]); | ||
|
||
$this->line("<options=bold,reverse;fg=green> User created with email {$email} </> 🤙\n"); | ||
|
||
$this->writeWelcomeMessage(); | ||
|
||
return 0; | ||
} | ||
|
||
public function writeLogo() | ||
{ | ||
$asciiLogo = <<<EOT | ||
$$$$$$$$\ $$$$$$\ $$\ $$\ $$$$$$\ $$\ $$\ $$$$$$\ $$$$$$$$\ | ||
$$ _____|\_$$ _|$$$\ $$ |$$ __$$\ $$$\ $$ |$$ __$$\ $$ _____| | ||
$$ | $$ | $$$$\ $$ |$$ / $$ |$$$$\ $$ |$$ / \__|$$ | | ||
$$$$$\ $$ | $$ $$\$$ |$$$$$$$$ |$$ $$\$$ |$$ | $$$$$\ | ||
$$ __| $$ | $$ \$$$$ |$$ __$$ |$$ \$$$$ |$$ | $$ __| | ||
$$ | $$ | $$ |\$$$ |$$ | $$ |$$ |\$$$ |$$ | $$\ $$ | | ||
$$ | $$$$$$\ $$ | \$$ |$$ | $$ |$$ | \$$ |\$$$$$$ |$$$$$$$$\ | ||
\__| \______|\__| \__|\__| \__|\__| \__| \______/ \________| | ||
EOT; | ||
|
||
$this->line("\n".$asciiLogo."\n"); | ||
} | ||
|
||
public function writeWelcomeMessage() | ||
{ | ||
if ($this->confirm('Would you like to show some love by supporting this project?')) { | ||
if(PHP_OS_FAMILY == 'Darwin') exec('open https://opencollective.com/persona-finance'); | ||
if(PHP_OS_FAMILY == 'Windows') exec('start https://opencollective.com/persona-finance'); | ||
if(PHP_OS_FAMILY == 'Linux') exec('xdg-open https://opencollective.com/persona-finance'); | ||
|
||
$this->line("Thanks! Means the world to me!"); | ||
} | ||
} | ||
} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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,50 @@ | ||
# For more information: https://laravel.com/docs/sail | ||
version: '3' | ||
services: | ||
laravel.test: | ||
build: | ||
context: ./vendor/laravel/sail/runtimes/8.1 | ||
dockerfile: Dockerfile | ||
args: | ||
WWWGROUP: '${WWWGROUP}' | ||
image: sail-8.1/app | ||
extra_hosts: | ||
- 'host.docker.internal:host-gateway' | ||
ports: | ||
- '${APP_PORT:-80}:80' | ||
environment: | ||
WWWUSER: '${WWWUSER}' | ||
LARAVEL_SAIL: 1 | ||
XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}' | ||
XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}' | ||
volumes: | ||
- '.:/var/www/html' | ||
networks: | ||
- sail | ||
depends_on: | ||
- mysql | ||
mysql: | ||
image: 'mysql/mysql-server:8.0' | ||
ports: | ||
- '${FORWARD_DB_PORT:-3306}:3306' | ||
environment: | ||
MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}' | ||
MYSQL_ROOT_HOST: "%" | ||
MYSQL_DATABASE: '${DB_DATABASE}' | ||
MYSQL_USER: '${DB_USERNAME}' | ||
MYSQL_PASSWORD: '${DB_PASSWORD}' | ||
MYSQL_ALLOW_EMPTY_PASSWORD: 1 | ||
volumes: | ||
- 'sailmysql:/var/lib/mysql' | ||
networks: | ||
- sail | ||
healthcheck: | ||
test: ["CMD", "mysqladmin", "ping", "-p${DB_PASSWORD}"] | ||
retries: 3 | ||
timeout: 5s | ||
networks: | ||
sail: | ||
driver: bridge | ||
volumes: | ||
sailmysql: | ||
driver: local |