mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-05-29 15:44:41 +00:00
removed deprecated commands
This commit is contained in:
@@ -1,125 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Console\Commands;
|
|
||||||
|
|
||||||
use App\User;
|
|
||||||
use App\UserSettings;
|
|
||||||
use Illuminate\Console\Command;
|
|
||||||
|
|
||||||
class SetupDevEnvironment extends Command
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* The name and signature of the console command.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
protected $signature = 'setup:dev';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The console command description.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
protected $description = 'Setting production environment';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new command instance.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
parent::__construct();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Execute the console command.
|
|
||||||
*
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function handle()
|
|
||||||
{
|
|
||||||
$this->info('Setting up production environment');
|
|
||||||
|
|
||||||
$this->migrateDatabase();
|
|
||||||
$this->generateKey();
|
|
||||||
$this->createPassportKeys();
|
|
||||||
$this->createPassportClientPassword();
|
|
||||||
$this->createPassportClientPersonal();
|
|
||||||
$this->createDefaultUser();
|
|
||||||
|
|
||||||
$this->info('Everything is done, congratulations! 🥳🥳🥳');
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Migrate database
|
|
||||||
*/
|
|
||||||
public function generateKey()
|
|
||||||
{
|
|
||||||
$this->call('key:generate');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Migrate database
|
|
||||||
*/
|
|
||||||
public function migrateDatabase()
|
|
||||||
{
|
|
||||||
$this->call('migrate:fresh');
|
|
||||||
$this->call('db:seed');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create Passport Encryption keys
|
|
||||||
*/
|
|
||||||
public function createPassportKeys()
|
|
||||||
{
|
|
||||||
$this->call('passport:keys', [
|
|
||||||
'--force' => true
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create Password grant client
|
|
||||||
*/
|
|
||||||
public function createPassportClientPassword()
|
|
||||||
{
|
|
||||||
$this->call('passport:client', [
|
|
||||||
'--password' => true,
|
|
||||||
'--name' => 'vuefilemanager',
|
|
||||||
]);
|
|
||||||
|
|
||||||
$this->alert('Please copy these first password grant Client ID & Client secret above to your /.env file.');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create Personal access client
|
|
||||||
*/
|
|
||||||
public function createPassportClientPersonal()
|
|
||||||
{
|
|
||||||
$this->call('passport:client', [
|
|
||||||
'--personal' => true,
|
|
||||||
'--name' => 'shared',
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create Default User
|
|
||||||
*/
|
|
||||||
public function createDefaultUser()
|
|
||||||
{
|
|
||||||
$user = User::create([
|
|
||||||
'name' => 'Jane Doe',
|
|
||||||
'email' => 'howdy@hi5ve.digital',
|
|
||||||
'role' => 'admin',
|
|
||||||
'password' => \Hash::make('vuefilemanager'),
|
|
||||||
]);
|
|
||||||
|
|
||||||
// Create settings
|
|
||||||
$settings = UserSettings::create([
|
|
||||||
'user_id' => $user->id
|
|
||||||
]);
|
|
||||||
|
|
||||||
$this->info('Test user created. Email: ' . $user->email . ' Password: vuefilemanager');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,101 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Console\Commands;
|
|
||||||
|
|
||||||
use Illuminate\Console\Command;
|
|
||||||
|
|
||||||
class SetupProductionEnvironment extends Command
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* The name and signature of the console command.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
protected $signature = 'setup:prod';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The console command description.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
protected $description = 'Setting production environment';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new command instance.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
parent::__construct();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Execute the console command.
|
|
||||||
*
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function handle()
|
|
||||||
{
|
|
||||||
$this->info('Setting up production environment');
|
|
||||||
|
|
||||||
$this->migrateDatabase();
|
|
||||||
$this->generateKey();
|
|
||||||
$this->createPassportKeys();
|
|
||||||
$this->createPassportClientPassword();
|
|
||||||
$this->createPassportClientPersonal();
|
|
||||||
|
|
||||||
$this->info('Everything is done, congratulations! 🥳🥳🥳');
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Migrate database
|
|
||||||
*/
|
|
||||||
public function generateKey()
|
|
||||||
{
|
|
||||||
$this->call('key:generate');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Migrate database
|
|
||||||
*/
|
|
||||||
public function migrateDatabase()
|
|
||||||
{
|
|
||||||
$this->call('migrate:fresh');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create Passport Encryption keys
|
|
||||||
*/
|
|
||||||
public function createPassportKeys()
|
|
||||||
{
|
|
||||||
$this->call('passport:keys', [
|
|
||||||
'--force' => true
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create Password grant client
|
|
||||||
*/
|
|
||||||
public function createPassportClientPassword()
|
|
||||||
{
|
|
||||||
$this->call('passport:client', [
|
|
||||||
'--password' => true,
|
|
||||||
'--name' => 'vuefilemanager',
|
|
||||||
]);
|
|
||||||
|
|
||||||
$this->alert('Please copy these first password grant Client ID & Client secret above to your /.env file.');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create Personal access client
|
|
||||||
*/
|
|
||||||
public function createPassportClientPersonal()
|
|
||||||
{
|
|
||||||
$this->call('passport:client', [
|
|
||||||
'--personal' => true,
|
|
||||||
'--name' => 'shared',
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,107 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Console\Commands;
|
|
||||||
|
|
||||||
use App\User;
|
|
||||||
use App\UserSettings;
|
|
||||||
use Illuminate\Console\Command;
|
|
||||||
|
|
||||||
class UpgradeApp extends Command
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* The name and signature of the console command.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
protected $signature = 'upgrade:app {version}';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The console command description.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
protected $description = 'Upgrade application to new version';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new command instance.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
parent::__construct();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Execute the console command.
|
|
||||||
*
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function handle()
|
|
||||||
{
|
|
||||||
$this->info('Upgrading your application to version ' . $this->argument('version'));
|
|
||||||
$this->call('down');
|
|
||||||
|
|
||||||
// Version 1.7
|
|
||||||
if ($this->argument('version') === 'v1.7') {
|
|
||||||
$this->version_1_7();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Version 1.6
|
|
||||||
if ($this->argument('version') === 'v1.6') {
|
|
||||||
$this->version_1_6();
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->call('up');
|
|
||||||
$this->info('Your application was upgraded! 🥳🥳🥳');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Upgrade script to version 1.7
|
|
||||||
*/
|
|
||||||
public function version_1_7() {
|
|
||||||
|
|
||||||
// Migrate new tables and changes
|
|
||||||
$this->call('migrate');
|
|
||||||
$this->call('rinvex:migrate:subscriptions');
|
|
||||||
|
|
||||||
/*$this->call('db:seed', [
|
|
||||||
'--class' => 'PaymentGatewaysSeeder'
|
|
||||||
]);*/
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Upgrade script to version 1.6
|
|
||||||
*/
|
|
||||||
public function version_1_6() {
|
|
||||||
|
|
||||||
// Migrate new tables and changes
|
|
||||||
$this->call('migrate');
|
|
||||||
|
|
||||||
// Create user settings records
|
|
||||||
$this->info('Updating users options...');
|
|
||||||
|
|
||||||
User::all()->each(function ($user) {
|
|
||||||
$this->info('Update user with id: ' . $user->id);
|
|
||||||
UserSettings::create(['user_id' => $user->id]);
|
|
||||||
});
|
|
||||||
|
|
||||||
$this->info('Updating user options is done!');
|
|
||||||
|
|
||||||
// Set up admin
|
|
||||||
$email = $this->ask('Which user would you like set up as admin? Please type user email');
|
|
||||||
|
|
||||||
$admin = User::where('email', $email)->first();
|
|
||||||
|
|
||||||
if (! $admin) {
|
|
||||||
$email = $this->ask('We can\'t find user with this email, please try it again');
|
|
||||||
$admin = User::where('email', $email)->first();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Save new role for selected user
|
|
||||||
$admin->role = 'admin';
|
|
||||||
$admin->save();
|
|
||||||
|
|
||||||
$this->info('Admin was set up successfully');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user