clrghouz/app/Console/Commands/NodelistImport.php

44 lines
855 B
PHP

<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Jobs\NodelistImport as Job;
use App\Models\File;
class NodelistImport extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'nodelist:import'
.' {file : File ID | filename}'
.' {domain? : Domain Name}'
.' {--D|delete : Delete old data for the date}'
.' {--U|unlink : Delete file after import}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Import Nodelist';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
return Job::dispatchSync(
is_numeric($x=$this->argument('file')) ? File::findOrFail($x) : $x,
$this->argument('domain'),
$this->option('delete'),
$this->option('unlink')
);
}
}