/** * Execute the console command. * * @return mixed */ public function fire() { $name = $this->input->getArgument('name'); $path = $this->input->getOption('path'); if ($path && !file_exists(base_path($path))) { $this->error(sprintf('Not exists [%s]', base_path($path))); return; } $files = []; if ($path && !is_dir(base_path($path))) { $files = [base_path($path)]; } else { $dirPath = !$path ? $this->getLangsDir($name) : base_path($path); $dir = dir($dirPath); while ($entry = $dir->read()) { $path = $dirPath . DIRECTORY_SEPARATOR . $entry; if (is_dir($path)) { continue; } $files[] = $path; } } foreach ($files as $file) { $this->translator->putFromLangDataSource($this->getNamespace($name), $file); } $this->info('Language import complete!'); }
/** * Execute the console command. * * @return mixed */ public function fire() { $namespace = $this->input->getOption('ns'); if ($namespace == false) { $this->error('네임스페이스를 입력하세요.'); return null; } $path = $this->input->getOption('path'); if ($path == false) { $this->error('다국어 파일 위치를 입력하세요.'); return null; } $path = base_path($path); if (file_exists($path) === false) { $this->error('다국어 파일을 찾을 수 없습니다.'); return null; } $this->translator->putFromLangDataSource($namespace, $path); $this->info('Language import complete!'); }