101 lines
8.2 KiB
PHP
101 lines
8.2 KiB
PHP
<?php
|
||
|
||
namespace Database\Seeders;
|
||
|
||
use Illuminate\Database\Seeder;
|
||
use Illuminate\Support\Facades\DB;
|
||
|
||
class MenuSeeder extends Seeder
|
||
{
|
||
public function run(): void
|
||
{
|
||
DB::table('menus')->truncate();
|
||
|
||
$now = now();
|
||
|
||
// ── HEADER menüsü ─────────────────────────────────────────────────
|
||
$headerItems = [
|
||
['location' => 'header', 'label' => 'Anasayfa', 'url' => '/', 'type' => 'link', 'parent_id' => null, 'order' => 1, 'is_active' => true],
|
||
['location' => 'header', 'label' => 'Kurumsal', 'url' => '/kurumsal', 'type' => 'link', 'parent_id' => null, 'order' => 2, 'is_active' => true],
|
||
['location' => 'header', 'label' => 'Eğitimler', 'url' => '/egitimler', 'type' => 'link', 'parent_id' => null, 'order' => 3, 'is_active' => true],
|
||
['location' => 'header', 'label' => 'Eğitim Takvimi', 'url' => '/egitim-takvimi', 'type' => 'link', 'parent_id' => null, 'order' => 4, 'is_active' => true],
|
||
['location' => 'header', 'label' => 'Duyurular', 'url' => '/duyurular', 'type' => 'link', 'parent_id' => null, 'order' => 5, 'is_active' => true],
|
||
['location' => 'header', 'label' => 'S.S.S.', 'url' => '/sss', 'type' => 'link', 'parent_id' => null, 'order' => 6, 'is_active' => true],
|
||
['location' => 'header', 'label' => 'İletişim', 'url' => '/iletisim', 'type' => 'link', 'parent_id' => null, 'order' => 7, 'is_active' => true],
|
||
];
|
||
|
||
foreach ($headerItems as $item) {
|
||
DB::table('menus')->insert(array_merge($item, ['created_at' => $now, 'updated_at' => $now]));
|
||
}
|
||
|
||
// Kurumsal dropdown parent id
|
||
$kurumsalId = DB::table('menus')->where('label', 'Kurumsal')->where('location', 'header')->value('id');
|
||
|
||
$kurumsalChildren = [
|
||
['location' => 'header', 'label' => 'Hakkımızda', 'url' => '/kurumsal/hakkimizda', 'type' => 'link', 'parent_id' => $kurumsalId, 'order' => 1, 'is_active' => true],
|
||
['location' => 'header', 'label' => 'Vizyon ve Misyon', 'url' => '/kurumsal/vizyon-ve-misyon', 'type' => 'link', 'parent_id' => $kurumsalId, 'order' => 2, 'is_active' => true],
|
||
['location' => 'header', 'label' => 'Kalite Politikamız', 'url' => '/kurumsal/kalite-politikamiz', 'type' => 'link', 'parent_id' => $kurumsalId, 'order' => 3, 'is_active' => true],
|
||
];
|
||
|
||
foreach ($kurumsalChildren as $item) {
|
||
DB::table('menus')->insert(array_merge($item, ['created_at' => $now, 'updated_at' => $now]));
|
||
}
|
||
|
||
// Eğitimler dropdown parent id
|
||
$egitimlerParentId = DB::table('menus')->where('label', 'Eğitimler')->where('location', 'header')->value('id');
|
||
|
||
$egitimlerChildren = [
|
||
['location' => 'header', 'label' => 'Güverte Eğitimleri', 'url' => '/egitimler/guverte', 'type' => 'category', 'parent_id' => $egitimlerParentId, 'order' => 1, 'is_active' => true],
|
||
['location' => 'header', 'label' => 'STCW Eğitimleri', 'url' => '/egitimler/stcw', 'type' => 'category', 'parent_id' => $egitimlerParentId, 'order' => 2, 'is_active' => true],
|
||
['location' => 'header', 'label' => 'Makine Eğitimleri', 'url' => '/egitimler/makine', 'type' => 'category', 'parent_id' => $egitimlerParentId, 'order' => 3, 'is_active' => true],
|
||
['location' => 'header', 'label' => 'Yat Kaptanlığı', 'url' => '/egitimler/yat-kaptanligi', 'type' => 'category', 'parent_id' => $egitimlerParentId, 'order' => 4, 'is_active' => true],
|
||
['location' => 'header', 'label' => 'Yenileme Eğitimleri', 'url' => '/egitimler/yenileme', 'type' => 'category', 'parent_id' => $egitimlerParentId, 'order' => 5, 'is_active' => true],
|
||
['location' => 'header', 'label' => 'Güvenlik (ISPS)', 'url' => '/egitimler/guvenlik', 'type' => 'category', 'parent_id' => $egitimlerParentId, 'order' => 6, 'is_active' => true],
|
||
];
|
||
|
||
foreach ($egitimlerChildren as $item) {
|
||
DB::table('menus')->insert(array_merge($item, ['created_at' => $now, 'updated_at' => $now]));
|
||
}
|
||
|
||
// ── FOOTER menüsü ─────────────────────────────────────────────────
|
||
$footerItems = [
|
||
// Kurumsal grubu
|
||
['location' => 'footer', 'label' => 'Kurumsal', 'url' => '/kurumsal', 'type' => 'link', 'parent_id' => null, 'order' => 1, 'is_active' => true],
|
||
['location' => 'footer', 'label' => 'Eğitimler', 'url' => '/egitimler', 'type' => 'link', 'parent_id' => null, 'order' => 2, 'is_active' => true],
|
||
['location' => 'footer', 'label' => 'Hızlı Linkler', 'url' => '#', 'type' => 'link', 'parent_id' => null, 'order' => 3, 'is_active' => true],
|
||
];
|
||
|
||
foreach ($footerItems as $item) {
|
||
DB::table('menus')->insert(array_merge($item, ['created_at' => $now, 'updated_at' => $now]));
|
||
}
|
||
|
||
$footerKurumsalId = DB::table('menus')->where('label', 'Kurumsal')->where('location', 'footer')->value('id');
|
||
$footerEgitimId = DB::table('menus')->where('label', 'Eğitimler')->where('location', 'footer')->value('id');
|
||
$footerHizliId = DB::table('menus')->where('label', 'Hızlı Linkler')->where('location', 'footer')->value('id');
|
||
|
||
$footerChildren = [
|
||
// Kurumsal alt menü
|
||
['location' => 'footer', 'label' => 'Hakkımızda', 'url' => '/kurumsal/hakkimizda', 'type' => 'link', 'parent_id' => $footerKurumsalId, 'order' => 1, 'is_active' => true],
|
||
['location' => 'footer', 'label' => 'Misyon & Vizyon', 'url' => '/kurumsal/vizyon-ve-misyon', 'type' => 'link', 'parent_id' => $footerKurumsalId, 'order' => 2, 'is_active' => true],
|
||
['location' => 'footer', 'label' => 'Kalite Politikamız', 'url' => '/kurumsal/kalite-politikamiz', 'type' => 'link', 'parent_id' => $footerKurumsalId, 'order' => 3, 'is_active' => true],
|
||
['location' => 'footer', 'label' => 'İletişim', 'url' => '/iletisim', 'type' => 'link', 'parent_id' => $footerKurumsalId, 'order' => 4, 'is_active' => true],
|
||
|
||
// Eğitimler alt menü
|
||
['location' => 'footer', 'label' => 'Tüm Eğitimler', 'url' => '/egitimler', 'type' => 'link', 'parent_id' => $footerEgitimId, 'order' => 1, 'is_active' => true],
|
||
['location' => 'footer', 'label' => 'Güverte Eğitimleri', 'url' => '/egitimler/guverte', 'type' => 'link', 'parent_id' => $footerEgitimId, 'order' => 2, 'is_active' => true],
|
||
['location' => 'footer', 'label' => 'STCW Eğitimleri', 'url' => '/egitimler/stcw', 'type' => 'link', 'parent_id' => $footerEgitimId, 'order' => 3, 'is_active' => true],
|
||
['location' => 'footer', 'label' => 'Yat Kaptanlığı', 'url' => '/egitimler/yat-kaptanligi', 'type' => 'link', 'parent_id' => $footerEgitimId, 'order' => 4, 'is_active' => true],
|
||
|
||
// Hızlı Linkler alt menü
|
||
['location' => 'footer', 'label' => 'Eğitim Takvimi', 'url' => '/egitim-takvimi', 'type' => 'link', 'parent_id' => $footerHizliId, 'order' => 1, 'is_active' => true],
|
||
['location' => 'footer', 'label' => 'Duyurular & Haberler', 'url' => '/duyurular', 'type' => 'link', 'parent_id' => $footerHizliId, 'order' => 2, 'is_active' => true],
|
||
['location' => 'footer', 'label' => 'Ön Kayıt Ekranı', 'url' => '/kayit', 'type' => 'link', 'parent_id' => $footerHizliId, 'order' => 3, 'is_active' => true],
|
||
['location' => 'footer', 'label' => 'S.S.S.', 'url' => '/sss', 'type' => 'link', 'parent_id' => $footerHizliId, 'order' => 4, 'is_active' => true],
|
||
];
|
||
|
||
foreach ($footerChildren as $item) {
|
||
DB::table('menus')->insert(array_merge($item, ['created_at' => $now, 'updated_at' => $now]));
|
||
}
|
||
}
|
||
}
|