Files
newznab-tmux/app/Console/Commands/FixturesUp.php
T
DariusIII 02ad342bac Apply fixes from StyleCI
[ci skip] [skip ci]
2020-02-05 01:56:40 +00:00

77 lines
1.7 KiB
PHP

<?php
namespace App\Console\Commands;
use DariusIII\L5Fixtures\FixturesFacade;
use Illuminate\Console\Command;
class FixturesUp extends Command
{
/**
* @var array
*/
private static $allowedTables = [
'binaryblacklist',
'root_categories',
'categories',
'category_regexes',
'collection_regexes',
'content',
'usenet_groups',
'release_naming_regexes',
'settings',
];
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'fixtures:up {--t|table=* : Populate all, multiple or single table}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Apply database fixtures to all tables or just to select ones.
Tables that are supported are :
no argument <= Populates all the tables listed below
binaryblacklist
root_categories
categories
category_regexes
collection_regexes
content
usenet_groups
release_naming_regexes
settings';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*/
public function handle()
{
if (empty($this->option('table'))) {
$this->info('Populating all tables');
FixturesFacade::up();
} else {
foreach ($this->option('table') as $option) {
if (\in_array($option, self::$allowedTables, false)) {
$this->info('Populating '.$option.' table');
FixturesFacade::up($option);
}
}
}
}
}