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!');
}