Enhance nodelist import
This commit is contained in:
@@ -2,10 +2,8 @@
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
use App\Models\{Domain,Nodelist};
|
||||
use App\Jobs\NodelistImport as Job;
|
||||
|
||||
class NodelistImport extends Command
|
||||
@@ -16,9 +14,9 @@ class NodelistImport extends Command
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'nodelist:import'
|
||||
.' {domain : Domain Name}'
|
||||
.' {file : Nodelist File}'
|
||||
.' {--D|delete : Delete old data for the date}';
|
||||
.' {--D|delete : Delete old data for the date}'
|
||||
.' {--U|unlink : Delete file after import}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
@@ -27,16 +25,6 @@ class NodelistImport extends Command
|
||||
*/
|
||||
protected $description = 'Import Nodelist';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
@@ -44,9 +32,6 @@ class NodelistImport extends Command
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$do = Domain::where('name',$this->argument('domain'))->singleOrFail();
|
||||
$o = Nodelist::firstOrCreate(['date'=>Carbon::now(),'domain_id'=>$do->id]);
|
||||
|
||||
return Job::dispatchSync($do,$o,$this->argument('file'),$this->option('delete'));
|
||||
return Job::dispatchSync($this->argument('file'),$this->option('delete'),$this->option('unlink'));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user