Repositories/SettingRepository.php
public function seed($data)
    {
        if (!is_array($data)) {
            throw new \Exception('Passed settings should be an array');
        }

        foreach ($data as $item) {
            if (!isset($item['group'])) {
                throw new \Exception('Group does not exist for key: ' . $item['key']);
            }

            $item['key'] = implode('.', [
                $item['group'],
                $item['key']
            ]);

            $translations = [];
            if (isset($item['value']) && is_array($item['value'])) {
                foreach ($item['value'] as $locale => $value) {
                    $translations[$locale] = [
                        'value' => $value
                    ];
                }
            } else {
                foreach (TransHelper::getAllLanguages() as $language) {
                    $translations[$language->iso_code] = [
                        'value' => isset($item['value']) ? $item['value'] : '',
                    ];
                }
            }

            $setting = Setting::firstOrCreate([
                'key' => $item['key']
            ], array_except($item, 'value'));

            $setting->updateTranslations($translations);
        }
    }
public function seed($data)
    {
        if (!is_array($data)) {
            throw new \Exception('Passed settings should be an array');
        }

        foreach ($data as $item) {
            if (!isset($item['group'])) {
                throw new \Exception('Group does not exist for key: ' . $item['key']);
            }

            $item['key'] = implode('.', [
                $item['group'],
                $item['key']
            ]);

            $translations = [];
            if (isset($item['value']) && is_array($item['value'])) {
                foreach ($item['value'] as $locale => $value) {
                    $translations[$locale] = [
                        'value' => $value
                    ];
                }
            } else {
                foreach (TransHelper::getAllLanguages() as $language) {
                    $translations[$language->iso_code] = [
                        'value' => isset($item['value']) ? $item['value'] : '',
                    ];
                }
            }

            $setting = Setting::firstOrCreate([
                'key' => $item['key']
            ], array_except($item, 'value'));

            $setting->updateTranslations($translations);
        }
    }
Seed settings

@param $data
@return void
@throws \Exception