55 lines
1.2 KiB
PHP
55 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
use App\Handlers\UlbXmlImportHandler;
|
|
use Illuminate\Console\Command;
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
class ImportUlbXmlData extends Command
|
|
{
|
|
/**
|
|
* The name and signature of the console command.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $signature = 'gwt:import-ulb-xml';
|
|
|
|
/**
|
|
* The console command description.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $description = 'Import ULB data from XML file';
|
|
|
|
/**
|
|
* Create a new command instance.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
}
|
|
|
|
/**
|
|
* Execute the console command.
|
|
*
|
|
* @return mixed
|
|
*/
|
|
public function handle()
|
|
{
|
|
$this->info('Clearing out existing NT data...');
|
|
DB::statement("SET FOREIGN_KEY_CHECKS=0");
|
|
DB::table('verses')->truncate();
|
|
DB::table('chapters')->truncate();
|
|
DB::table('books')->truncate();
|
|
DB::table('words')->truncate();
|
|
DB::statement("SET FOREIGN_KEY_CHECKS=1");
|
|
|
|
$this->info('Importing fresh NT data...');
|
|
$importHandler = new UlbXmlImportHandler($this->output);
|
|
$importHandler->run();
|
|
}
|
|
}
|