Fix validFrom, validTo in result table
This commit is contained in:
@@ -5,7 +5,7 @@ namespace App\Console\Commands;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use JsonMachine\Items;
|
||||
use JsonMachine\JsonDecoder\PassThruDecoder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class Import extends Command
|
||||
{
|
||||
@@ -16,6 +16,7 @@ class Import extends Command
|
||||
*/
|
||||
protected $signature = 'import {dir}';
|
||||
|
||||
protected $RpoTree;
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
@@ -23,13 +24,19 @@ class Import extends Command
|
||||
*/
|
||||
protected $description = 'Import data from gzipped backup init files';
|
||||
|
||||
public function transformItem($item)
|
||||
{
|
||||
return $item;
|
||||
}
|
||||
|
||||
public function ImportToDB($dir, $files)
|
||||
{
|
||||
foreach ($files as $file) {
|
||||
$stream = gzopen($dir.'/'.$file,'rb');
|
||||
$items = Items::fromStream($stream, ['pointer' => '/results']);
|
||||
foreach ($items as $item) {
|
||||
dd($item);
|
||||
$item = $this->transformItem($item);
|
||||
DB::table('data')->insert($item);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -55,6 +62,8 @@ class Import extends Command
|
||||
|
||||
$files = explode(PHP_EOL, File::get($file));
|
||||
|
||||
$this->RpoTree = json_decode(File::get(resource_path('js/Data/RpoTree.json')));
|
||||
|
||||
$this->ImportToDB($dir, $files);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user