DcatSeeder::seedLanguages PHP Method

seedLanguages() private method

Seed the languages
private seedLanguages ( ) : void
return void
    private function seedLanguages()
    {
        $this->command->info('---- DCAT Languages ----');
        // Fetch the languages from the json file
        $this->command->info('Trying to fetch the languages from the local json file.');
        // Fetch the languages from the json file
        $languages = json_decode(file_get_contents(app_path() . '/database/seeds/data/languages.json'));
        if (!empty($languages)) {
            $this->command->info('Languages have been found, deleting the current ones, and replacing them with the new ones.');
            $this->command->info('Emptying the current languages table.');
            // Empty the languages table
            \Language::truncate();
            foreach ($languages as $language) {
                \Language::create(array('lang_id' => $language->lang_id, 'lang_code' => $language->lang_code, 'name' => $language->name));
            }
            $this->command->info('Added the languages from a local json file.');
        } else {
            $this->command->info('No languages have not been found, the old ones will not be replaced.');
        }
    }