2023-09-14 13:42:25 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
|
|
|
|
use Illuminate\Console\Command;
|
|
|
|
|
|
|
|
use App\Models\Domain;
|
|
|
|
use App\Jobs\FileareaImport as Job;
|
|
|
|
|
|
|
|
class FileareaImport extends Command
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* The name and signature of the console command.
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
protected $signature = 'filearea: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 Filearea';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Execute the console command.
|
|
|
|
*
|
2024-05-27 05:08:39 +00:00
|
|
|
* @return int
|
2023-09-14 13:42:25 +00:00
|
|
|
*/
|
2024-05-27 05:08:39 +00:00
|
|
|
public function handle(): int
|
2023-09-14 13:42:25 +00:00
|
|
|
{
|
|
|
|
$do = Domain::where('name',strtolower($this->argument('domain')))->singleOrFail();
|
|
|
|
return Job::dispatchSync($this->argument('file'),$do,$this->option('prefix'),$this->option('unlink'));
|
|
|
|
}
|
|
|
|
}
|