master
sergeybodin 2023-08-09 12:15:11 +03:00
parent eaa9d73e80
commit 14ce14820e
1 changed files with 20 additions and 18 deletions

View File

@ -118,35 +118,36 @@ class PagesTableSeeder extends Seeder
'sub_type' => PageSubType::PUBLICATION_NEWS
],
'Медиа' => [
// 'type' => PageType::PUBLICATIONS,
// 'sub_type' => PageSubType::PUBLICATION_NEWS
'children' => [
'Фотогалерея' => [
'type' => PageType::PUBLICATIONS,
'sub_type' => PageSubType::PUBLICATION_PHOTOS
],
'Видеоархив' => [
'type' => PageType::PUBLICATIONS,
'sub_type' => PageSubType::PUBLICATION_VIDEO
],
]
],
// 'СМИ о нас' => [
// 'type' => PageType::PUBLICATIONS,
// 'sub_type' => PageSubType::PUBLICATION_SMI
// ],
// 'Фотогалерея' => [
// 'type' => PageType::PUBLICATIONS,
// 'sub_type' => PageSubType::PUBLICATION_PHOTOS
// ],
// 'Видеоархив' => [
// 'type' => PageType::PUBLICATIONS,
// 'sub_type' => PageSubType::PUBLICATION_VIDEO
// ],
'Контакты для СМИ' => [],
]
],
'Контакты' => [
'children' => [
'Контактные данные' => [],
'Как добраться' => [],
'Консультации' => [],
'Обратная связь' => [],
]
// 'children' => [
// 'Контактные данные' => [],
// 'Как добраться' => [],
// 'Консультации' => [],
// 'Обратная связь' => [],
// ]
]
];
public function run() {
public function run()
{
$ord = 0;
collect($this->pages)->each(function ($data, $name) use (&$ord) {
$data['ord'] = $ord++;
@ -154,7 +155,8 @@ class PagesTableSeeder extends Seeder
});
}
public function importPage($name, $data, ?Page $parent = null) {
public function importPage($name, $data, ?Page $parent = null)
{
$slug = Str::slug(Str::transliterate($name));
$data += ['type' => $data['type'] ?? PageType::CONTENT, 'name' => $name];
$page = Page::firstOrCreate(['parent_id' => $parent->id ?? 0, 'slug' => $slug]);