[ 'title' => 'Виды списка', 'items' => ['marked' => 'Маркированный', 'numeric' => 'Нумерованный'] ], 'title-types' => [ 'title' => 'Виды заголовков', 'items' => ['h2' => 'Заголовок 1', 'h3' => 'Заголовок 2', 'h4' => 'Заголовок 3'] ], 'feedback-types' => [ 'title' => 'Тема обращения', 'items' => [ 'regulation' => 'Техническое нормирование', 'assessment' => 'Оценка пригодности', 'certification' => 'Добровольная сертификация', 'questions' => 'Вопросы нормирования и стандартизации', 'other' => 'Другие' ], ], 'operation-types' => [ 'title' => 'Виды операций', 'items' => ['development' => 'Разработка', 'rework' => 'Пересмотр', 'modification' => 'Изменение'] ], 'listings' => [ 'title' => 'Перечни ПП', 'items' => ['pp1521' => 'ПП №1521 от 26.12.2014 г.', 'pp985' => 'ПП № 985 от 04.07.2020 г.', 'pp815' => 'ПП № 815 от 28.05.2021 г.'] ], 'image-type' => [ 'title' => 'Тип изображения', 'items' => ['full-width' => 'во всю ширину', 'tiles' => 'плиткой', 'carousel' => 'карусель'] ], 'activities' => [ 'title' => 'Направления деятельности', 'items' => ['products' => 'Продукция в строительстве', 'services' => 'Работы и услуги', 'management' => 'СМК'] ], 'research-types' => [ 'title' => 'Виды исследовательских работ', 'items' => ['nir' => 'НИР', 'niokr' => 'НИОКР'] ], 'moderate-permissions' => [ 'title' => 'Права', 'items' => ['applications' => 'Рассмотрение предварительных заявок'] ] ]; public function run() { collect($this->dictionaries)->each(function($data, $name) { $dictionary = Dictionary::firstOrCreate(['name' => $name]); $dictionary->update(collect($data)->except('items')->all()); collect($data['items'] ?? [])->each(function($title, $name) use($dictionary) { $item = $dictionary->items()->firstOrCreate(['name' => $name]); $item->update(['title' => $title]); }); }); } }