/** * Execute the console command. * * @return mixed */ public function fire() { // Check if there are any currencies available $this->allCurrencies = $this->getCurrencies(true); if (!$this->allCurrencies->count()) { return $this->error('No currencies found. Did you seed the database?.'); } // If no currencies are provided ask for them interactively $this->selectedCurrencies = $this->argument('currency') ?: $this->askCurrencies(); // Check if all provided currencies exist if ($unknownCurrencies = $this->getUnknownCurrencies()) { return $this->error('Invdalid currencies: ' . PHP_EOL . implode(PHP_EOL, $unknownCurrencies)); } // Disable all DB::table('currencies')->update(['deleted_at' => '0000-00-00']); // Enable selected DB::table('currencies')->whereIn('id', $this->selectedCurrencies)->orWhereIn('code', $this->selectedCurrencies)->update(['deleted_at' => null]); // Show result $this->allCurrencies = $this->getCurrencies(false); $this->info('Enabled currencies'); $this->showCurrenciesList(); }
/** * Execute the console command. * * @return mixed */ public function fire() { // Check if there are any languages available $this->allLanguages = $this->getLanguages(true); if (!$this->allLanguages->count()) { return $this->error('No languages found. Did you seed the database?.'); } // If no languages are provided ask for them interactively $this->selectedLanguages = $this->argument('language') ?: $this->askLanguages(); // Check if all provided languages exist if ($unknownLanguages = $this->getUnknownLanguages()) { return $this->error('Invdalid languages: ' . PHP_EOL . implode(PHP_EOL, $unknownLanguages)); } // Disable all DB::table('languages')->update(['is_default' => 0, 'deleted_at' => '0000-00-00']); // Enable selected DB::table('languages')->whereIn('id', $this->selectedLanguages)->orWhereIn('code', $this->selectedLanguages)->update(['deleted_at' => null]); // Set default DB::table('languages')->where('id', $this->selectedLanguages[0])->orWhere('code', $this->selectedLanguages[0])->limit(1)->update(['is_default' => 1]); // Show result $this->allLanguages = $this->getLanguages(false); $this->info('Enabled languages'); $this->showLanguagesList(); }