272 lines
9.6 KiB
PHP
272 lines
9.6 KiB
PHP
<?php
|
||
|
||
namespace Database\Seeders;
|
||
|
||
use App\Models\Page;
|
||
use Illuminate\Database\Seeder;
|
||
|
||
class PageSeeder extends Seeder
|
||
{
|
||
/**
|
||
* Run the database seeds.
|
||
*/
|
||
public function run(): void
|
||
{
|
||
// İlk kullanıcıyı bul veya oluştur
|
||
$author = \App\Models\User::first();
|
||
if (!$author) {
|
||
$author = \App\Models\User::create([
|
||
'name' => 'Admin',
|
||
'email' => 'admin@truncgil.com',
|
||
'password' => bcrypt('password'),
|
||
]);
|
||
}
|
||
|
||
// 1. Anasayfa
|
||
$home = Page::updateOrCreate(
|
||
['slug' => 'home'],
|
||
[
|
||
'author_id' => $author->id,
|
||
'title' => 'Anasayfa',
|
||
'excerpt' => 'Modern ve yenilikçi teknoloji çözümleri',
|
||
'content' => null,
|
||
'template' => 'home',
|
||
'status' => 'published',
|
||
'is_homepage' => true,
|
||
'show_in_menu' => false,
|
||
'sort_order' => 1,
|
||
'published_at' => now(),
|
||
'meta_title' => 'Truncgil Teknoloji - Kurumsal',
|
||
'meta_description' => 'Truncgil Teknoloji kurumsal web sitesi.',
|
||
'sections' => [], // Sections will be handled by the template view for now or can be added here
|
||
]
|
||
);
|
||
|
||
// 2. Kurumsal (Parent)
|
||
$corporate = Page::updateOrCreate(
|
||
['slug' => 'kurumsal'],
|
||
[
|
||
'author_id' => $author->id,
|
||
'title' => 'Kurumsal',
|
||
'excerpt' => 'Kurumsal bilgilerimiz',
|
||
'content' => null,
|
||
'template' => 'generic',
|
||
'status' => 'published',
|
||
'is_homepage' => false,
|
||
'show_in_menu' => true,
|
||
'sort_order' => 1,
|
||
'published_at' => now(),
|
||
]
|
||
);
|
||
|
||
// 2.1 Hakkımızda (Child of Kurumsal)
|
||
Page::updateOrCreate(
|
||
['slug' => 'hakkimizda'],
|
||
[
|
||
'author_id' => $author->id,
|
||
'parent_id' => $corporate->id,
|
||
'title' => 'Hakkımızda',
|
||
'excerpt' => 'Biz kimiz?',
|
||
'content' => '<p>Trunçgil Teknoloji olarak 2014 yılından bu yana yazılım, e-ticaret, sağlık teknolojileri ve eğitim alanlarında yenilikçi çözümler üretiyoruz.</p>',
|
||
'template' => 'hakkimizda',
|
||
'status' => 'published',
|
||
'is_homepage' => false,
|
||
'show_in_menu' => true,
|
||
'sort_order' => 1,
|
||
'published_at' => now(),
|
||
]
|
||
);
|
||
|
||
// 2.2 Vizyon & Misyon (Child of Kurumsal)
|
||
Page::updateOrCreate(
|
||
['slug' => 'vizyon-misyon'],
|
||
[
|
||
'author_id' => $author->id,
|
||
'parent_id' => $corporate->id,
|
||
'title' => 'Vizyon & Misyon',
|
||
'excerpt' => 'Gelecek hedeflerimiz',
|
||
'content' => '<p>Vizyon ve Misyon içeriği...</p>',
|
||
'template' => 'generic',
|
||
'status' => 'published',
|
||
'is_homepage' => false,
|
||
'show_in_menu' => true,
|
||
'sort_order' => 2,
|
||
'published_at' => now(),
|
||
]
|
||
);
|
||
|
||
// 2.3 Kitaplarımız (Child of Kurumsal)
|
||
Page::updateOrCreate(
|
||
['slug' => 'kitaplarimiz'],
|
||
[
|
||
'author_id' => $author->id,
|
||
'parent_id' => $corporate->id,
|
||
'title' => 'Kitaplarımız',
|
||
'excerpt' => 'Yayınladığımız kitaplar',
|
||
'content' => null,
|
||
'template' => 'books.books',
|
||
'status' => 'published',
|
||
'is_homepage' => false,
|
||
'show_in_menu' => true,
|
||
'sort_order' => 3,
|
||
'published_at' => now(),
|
||
]
|
||
);
|
||
|
||
// 2.4 Banka Bilgilerimiz (Child of Kurumsal)
|
||
Page::updateOrCreate(
|
||
['slug' => 'banka-bilgilerimiz'],
|
||
[
|
||
'author_id' => $author->id,
|
||
'parent_id' => $corporate->id,
|
||
'title' => 'Banka Bilgilerimiz',
|
||
'excerpt' => 'Banka hesap bilgilerimiz',
|
||
'content' => '<p>Banka hesap bilgilerimiz burada yer alacaktır.</p>',
|
||
'template' => 'generic',
|
||
'status' => 'published',
|
||
'is_homepage' => false,
|
||
'show_in_menu' => true,
|
||
'sort_order' => 4,
|
||
'published_at' => now(),
|
||
]
|
||
);
|
||
|
||
// 2.5 Müşteri Görüşleri (Child of Kurumsal)
|
||
$testimonialsPage = Page::updateOrCreate(
|
||
['slug' => 'musteri-gorusleri'],
|
||
[
|
||
'author_id' => $author->id,
|
||
'parent_id' => $corporate->id,
|
||
'title' => 'Müşteri Görüşleri',
|
||
'excerpt' => 'Müşterilerimizin hakkımızdaki düşünceleri',
|
||
'content' => null,
|
||
'template' => 'corporate.testimonials',
|
||
'status' => 'published',
|
||
'is_homepage' => false,
|
||
'show_in_menu' => true,
|
||
'sort_order' => 5,
|
||
'published_at' => now(),
|
||
]
|
||
);
|
||
|
||
// Varsayılan müşteri görüşlerini ekle
|
||
$defaultTestimonials = [
|
||
[
|
||
'name' => 'Kerem Can Azak',
|
||
'position' => 'Stellar Construction',
|
||
'content' => 'Dijital dönüşüm yolculuğumuzda yanımızda oldukları için mutluyuz. Profesyonel yaklaşımları ve çözüm odaklı çalışmaları ile projelerimize değer kattılar.',
|
||
'rating' => 5,
|
||
'sort_order' => 1,
|
||
],
|
||
[
|
||
'name' => 'Servet Demir',
|
||
'position' => 'Dijimind Akademi',
|
||
'content' => 'Eğitim teknolojileri alanındaki vizyoner bakış açıları ve teknik altyapı konusundaki uzmanlıkları sayesinde hedeflediğimiz kitleye çok daha etkili bir şekilde ulaştık.',
|
||
'rating' => 5,
|
||
'sort_order' => 2,
|
||
],
|
||
[
|
||
'name' => 'A. Cezmi Savaş',
|
||
'position' => 'Rhapsode Akademik Yayınevi',
|
||
'content' => 'Akademik yayıncılık süreçlerimizi dijitalleştirirken sundukları yenilikçi çözümler ve hızlı destekleri için teşekkür ederiz. Güvenilir bir iş ortağı.',
|
||
'rating' => 5,
|
||
'sort_order' => 3,
|
||
],
|
||
];
|
||
|
||
foreach ($defaultTestimonials as $testimonialData) {
|
||
\App\Models\Testimonial::updateOrCreate(
|
||
['page_id' => $testimonialsPage->id, 'name' => $testimonialData['name']],
|
||
$testimonialData
|
||
);
|
||
}
|
||
|
||
// 3. Ürünlerimiz (Mega Menu Target)
|
||
Page::updateOrCreate(
|
||
['slug' => 'urunlerimiz'],
|
||
[
|
||
'author_id' => $author->id,
|
||
'title' => 'Ürünlerimiz',
|
||
'excerpt' => 'Ürün ve hizmetlerimiz',
|
||
'content' => null,
|
||
'template' => 'generic',
|
||
'status' => 'published',
|
||
'is_homepage' => false,
|
||
'show_in_menu' => true,
|
||
'sort_order' => 2,
|
||
'published_at' => now(),
|
||
]
|
||
);
|
||
|
||
// 4. Kariyer
|
||
Page::updateOrCreate(
|
||
['slug' => 'kariyer'],
|
||
[
|
||
'author_id' => $author->id,
|
||
'title' => 'Kariyer',
|
||
'excerpt' => 'Kariyer fırsatları',
|
||
'content' => '<p>Kariyer içeriği...</p>',
|
||
'template' => 'generic',
|
||
'status' => 'published',
|
||
'is_homepage' => false,
|
||
'show_in_menu' => true,
|
||
'sort_order' => 3,
|
||
'published_at' => now(),
|
||
]
|
||
);
|
||
|
||
// 5. Neler Yaparız
|
||
Page::updateOrCreate(
|
||
['slug' => 'neler-yapariz'],
|
||
[
|
||
'author_id' => $author->id,
|
||
'title' => 'Neler Yaparız',
|
||
'excerpt' => 'Hizmetlerimiz ve çözümlerimiz',
|
||
'content' => null,
|
||
'template' => 'neler-yapariz',
|
||
'status' => 'published',
|
||
'is_homepage' => false,
|
||
'show_in_menu' => true,
|
||
'sort_order' => 4,
|
||
'published_at' => now(),
|
||
]
|
||
);
|
||
|
||
// 6. Blog
|
||
Page::updateOrCreate(
|
||
['slug' => 'blog'],
|
||
[
|
||
'author_id' => $author->id,
|
||
'title' => 'Blog',
|
||
'excerpt' => 'Güncel haberler ve makaleler',
|
||
'content' => null,
|
||
'template' => 'blog',
|
||
'status' => 'published',
|
||
'is_homepage' => false,
|
||
'show_in_menu' => true,
|
||
'sort_order' => 5,
|
||
'published_at' => now(),
|
||
]
|
||
);
|
||
|
||
// 7. İletişim
|
||
Page::updateOrCreate(
|
||
['slug' => 'iletisim'],
|
||
[
|
||
'author_id' => $author->id,
|
||
'title' => 'İletişim',
|
||
'excerpt' => 'Bize ulaşın',
|
||
'content' => null,
|
||
'template' => 'contact',
|
||
'status' => 'published',
|
||
'is_homepage' => false,
|
||
'show_in_menu' => true,
|
||
'sort_order' => 6,
|
||
'published_at' => now(),
|
||
]
|
||
);
|
||
|
||
$this->command->info('✅ Menu yapısı ve sayfalar başarıyla oluşturuldu!');
|
||
}
|
||
}
|