'/results']); foreach ($items as $item) { $item = $this->transformItem($item); DB::table('data')->insert($item); } } } /** * Execute the console command. */ public function handle() { $dir = $this->argument('dir'); $files = File::glob($dir . '/*.txt'); $this->question('Which file to import?'); $i = 1; foreach ($files as $file) { $this->comment("[" . $i++ . "]. " . $file); } $num = $this->ask('Enter number:'); $file = $files[$num - 1]; $this->info('Your choice: ' . $file); $files = explode(PHP_EOL, File::get($file)); $this->RpoTree = json_decode(File::get(resource_path('js/Data/RpoTree.json'))); $this->ImportToDB($dir, $files); } }