2021-08-27 14:10:42 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
|
|
|
|
use Illuminate\Console\Command;
|
|
|
|
|
2022-06-26 14:14:36 +00:00
|
|
|
use App\Models\Domain;
|
2021-08-27 14:10:42 +00:00
|
|
|
use App\Jobs\EchoareaImport as Job;
|
|
|
|
|
|
|
|
class EchoareaImport extends Command
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* The name and signature of the console command.
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
protected $signature = 'echoarea:import'
|
|
|
|
.' {file : NA File}'
|
|
|
|
.' {domain : Domain}'
|
|
|
|
.' {--P|prefix= : Add prefix to description}'
|
|
|
|
.' {--U|unlink : Delete file after import}';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The console command description.
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
protected $description = 'Import Echoarea';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Execute the console command.
|
|
|
|
*
|
2024-05-27 05:08:39 +00:00
|
|
|
* @return int
|
2021-08-27 14:10:42 +00:00
|
|
|
*/
|
2024-05-27 05:08:39 +00:00
|
|
|
public function handle(): int
|
2021-08-27 14:10:42 +00:00
|
|
|
{
|
2024-11-08 12:31:21 +00:00
|
|
|
$do = Domain::where('name',strtolower($this->argument('domain')))->single();
|
|
|
|
|
2024-06-04 08:40:04 +00:00
|
|
|
return Job::dispatchSync($this->argument('file'),$do,$this->option('prefix') ?: '',$this->option('unlink'));
|
2021-08-27 14:10:42 +00:00
|
|
|
}
|
|
|
|
}
|