53 lines
1.2 KiB
PHP
53 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
use App\Http\Controllers\LoadDBController;
|
|
use Illuminate\Console\Command;
|
|
use League\Flysystem\Config;
|
|
|
|
class loadAll extends Command
|
|
{
|
|
/**
|
|
* The name and signature of the console command.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $signature = 'loadDB:all';
|
|
|
|
/**
|
|
* The console command description.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $description = 'Loads all the config from the json into the DB';
|
|
|
|
/**
|
|
* Create a new command instance.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
}
|
|
|
|
/**
|
|
* Execute the console command.
|
|
*
|
|
* @return int
|
|
*/
|
|
public function handle()
|
|
{
|
|
if (file_exists(env('JSON_FILE_PATH'))) {
|
|
$config = json_decode(file_get_contents(env('JSON_FILE_PATH')), true);
|
|
$loadDBController = new LoadDBController();
|
|
$loadDBController->loadUserdata($config['username'], $config['theme']);
|
|
return Command::SUCCESS;
|
|
} else {
|
|
print('Error: JSON File does not exist at given location'."\n");
|
|
return Command::FAILURE;
|
|
}
|
|
}
|
|
}
|