mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-29 01:08:56 +00:00
b13de2e79d
[ci skip] [skip ci]
80 lines
1.8 KiB
PHP
80 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
use Illuminate\Console\Command;
|
|
use Mayconbordin\L5Fixtures\FixturesFacade;
|
|
|
|
class FixturesDown extends Command
|
|
{
|
|
/**
|
|
* @var array
|
|
*/
|
|
private static $allowedTables = [
|
|
'binaryblacklist',
|
|
'categories',
|
|
'category_regexes',
|
|
'collection_regexes',
|
|
'content',
|
|
'groups',
|
|
'menu',
|
|
'release_naming_regexes',
|
|
'settings',
|
|
'tmux',
|
|
'user_roles',
|
|
];
|
|
/**
|
|
* The name and signature of the console command.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $signature = 'fixtures:down {type}';
|
|
|
|
/**
|
|
* The console command description.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $description = 'Truncate(empty) all tables or just select ones.
|
|
Tables that are supported are :
|
|
all <= Populates all the tables listed below
|
|
binaryblacklist
|
|
categories
|
|
category_regexes
|
|
collection_regexes
|
|
content
|
|
groups
|
|
menu
|
|
release_naming_regexes
|
|
settings
|
|
tmux
|
|
user_roles';
|
|
|
|
/**
|
|
* Create a new command instance.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
}
|
|
|
|
/**
|
|
* Execute the console command.
|
|
*/
|
|
public function handle()
|
|
{
|
|
if ($this->confirm('This command will truncate(empty) your tables. Should we continue?')) {
|
|
$this->info('Truncating '.$this->argument('type').' table(s)');
|
|
if ($this->argument('type') === 'all') {
|
|
FixturesFacade::down();
|
|
} elseif (\in_array($this->argument('type'), self::$allowedTables, false)) {
|
|
FixturesFacade::down($this->argument('type'));
|
|
}
|
|
} else {
|
|
$this->info('Command execution stopped');
|
|
}
|
|
}
|
|
}
|