Implement Product and ProductCategory Resources: Created new Filament resources for managing products and product categories, including pages for listing, creating, and editing. Added schemas for forms and tables, integrated translation support, and established relationships between products and categories. Enhanced the navigation structure to include product and service links in the frontend menu, improving overall site organization and user experience.

This commit is contained in:
Ümit Tunç
2025-12-30 22:16:45 +03:00
parent a5a3248c69
commit a85e6eebe0
33 changed files with 1919 additions and 549 deletions
@@ -0,0 +1,23 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\ProductCategory>
*/
class ProductCategoryFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
//
];
}
}
+23
View File
@@ -0,0 +1,23 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Product>
*/
class ProductFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
//
];
}
}
@@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('product_categories', function (Blueprint $table) {
$table->id();
$table->json('title'); // Translatable
$table->string('slug')->unique();
$table->foreignId('parent_id')->nullable()->constrained('product_categories')->nullOnDelete();
$table->integer('sort_order')->default(0);
$table->boolean('is_active')->default(true);
$table->softDeletes();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('product_categories');
}
};
@@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('products', function (Blueprint $table) {
$table->id();
$table->json('title'); // Translatable
$table->string('slug')->unique();
$table->enum('type', ['product', 'service'])->default('product');
$table->foreignId('product_category_id')->nullable()->constrained('product_categories')->nullOnDelete();
$table->string('hero_image')->nullable();
$table->json('content')->nullable(); // Translatable
$table->string('view_template')->nullable(); // Custom view path
$table->integer('sort_order')->default(0);
$table->boolean('is_active')->default(true);
$table->softDeletes();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('products');
}
};
+77 -242
View File
@@ -4,7 +4,6 @@ namespace Database\Seeders;
use App\Models\Page;
use Illuminate\Database\Seeder;
use Illuminate\Support\Str;
class PageSeeder extends Seeder
{
@@ -13,7 +12,7 @@ class PageSeeder extends Seeder
*/
public function run(): void
{
// İlk kullanıcıyı bul veya oluştur (author_id için gerekli)
// İlk kullanıcıyı bul veya oluştur
$author = \App\Models\User::first();
if (!$author) {
$author = \App\Models\User::create([
@@ -23,12 +22,12 @@ class PageSeeder extends Seeder
]);
}
$pages = [
// Home Page
// 1. Anasayfa
$home = Page::updateOrCreate(
['slug' => 'home'],
[
'author_id' => $author->id,
'title' => 'Anasayfa',
'slug' => 'home',
'excerpt' => 'Modern ve yenilikçi teknoloji çözümleri',
'content' => null,
'template' => 'home',
@@ -37,85 +36,19 @@ class PageSeeder extends Seeder
'show_in_menu' => true,
'sort_order' => 1,
'published_at' => now(),
'meta_title' => 'Truncgil Citrus - Modern Web Çözümleri',
'meta_description' => 'Yenilikçi teknoloji çözümleri ile geleceği şekillendiriyoruz. Modern web uygulamaları ve dijital dönüşüm hizmetleri.',
'sections' => [
[
'type' => 'hero',
'data' => [
'background_image' => 'assets/img/photos/blurry.png',
'badge' => 'YENİ PLATFORM',
'title' => 'Modern ve Çok Amaçlı <span class="text-[#e31e24]">Web Çözümleri</span>',
'subtitle' => 'Yenilikçi teknoloji çözümleri ile geleceği şekillendiriyoruz. Projelerinizi en son teknolojilerle hayata geçiriyoruz.',
'primary_button_text' => 'Hemen Başla',
'primary_button_url' => '#features',
'secondary_button_text' => 'Daha Fazla Bilgi',
'secondary_button_url' => '/about',
'hero_image' => 'assets/img/demos/f1.png',
],
],
[
'type' => 'features',
'data' => [
'bg_class' => '!bg-[#f0f0f8]',
'section_badge' => 'ÖZELLİKLER',
'section_title' => 'Neden Truncgil Citrus?',
'section_subtitle' => 'Modern teknolojiler ve uzman ekibimizle projelerinizi hayata geçiriyoruz',
'column_class' => 'md:w-6/12 lg:w-4/12',
'features' => [
[
'icon' => 'assets/img/demos/fi1.png',
'title' => 'Hızlı Çözümler',
'description' => 'Modern teknolojiler kullanarak projelerinizi hızlı ve verimli bir şekilde hayata geçiriyoruz.',
],
[
'icon' => 'assets/img/demos/fi2.png',
'title' => 'Güvenli Altyapı',
'description' => 'En son güvenlik standartlarını kullanarak verilerinizi koruma altına alıyoruz.',
],
[
'icon' => 'assets/img/demos/fi3.png',
'title' => 'Uzman Ekip',
'description' => 'Deneyimli ve uzman ekibimiz ile her zaman yanınızdayız.',
],
],
],
],
[
'type' => 'stats',
'data' => [
'bg_class' => '!bg-[#ffffff]',
'column_class' => 'md:w-6/12 lg:w-3/12',
'stats' => [
['number' => '500+', 'label' => 'Tamamlanan Proje'],
['number' => '300+', 'label' => 'Mutlu Müşteri'],
['number' => '50+', 'label' => 'Kazanılan Ödül'],
['number' => '25+', 'label' => 'Ekip Üyesi'],
],
],
],
[
'type' => 'cta',
'data' => [
'bg_class' => 'overflow-hidden',
'background_image' => 'assets/img/photos/blurry.png',
'icon' => 'assets/img/demos/icon-grape.png',
'title' => 'Benzersiz düşünün ve <span class="text-[#e31e24]">fark yaratın</span>',
'subtitle' => 'Binlerce müşterimiz tarafından güveniliyoruz. Siz de katılın ve projelerinizi hayata geçirin.',
'button_text' => 'İletişime Geç',
'button_url' => '/contact',
'button_icon' => 'uil uil-arrow-up-right',
],
],
],
],
'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
]
);
// About Page
// 2. Kurumsal (Parent)
$corporate = Page::updateOrCreate(
['slug' => 'kurumsal'],
[
'author_id' => $author->id,
'title' => 'Hakkımızda',
'slug' => 'about',
'excerpt' => 'Truncgil Citrus olarak yenilikçi teknoloji çözümleri sunuyoruz',
'title' => 'Kurumsal',
'excerpt' => 'Kurumsal bilgilerimiz',
'content' => null,
'template' => 'generic',
'status' => 'published',
@@ -123,41 +56,52 @@ class PageSeeder extends Seeder
'show_in_menu' => true,
'sort_order' => 2,
'published_at' => now(),
'meta_title' => 'Hakkımızda - Truncgil Citrus',
'meta_description' => 'Truncgil Citrus olarak yenilikçi teknoloji çözümleri sunuyor, dijital dönüşüm süreçlerinizde yanınızdayız.',
'sections' => [
[
'type' => 'hero',
'data' => [
'badge' => 'HAKKIMIZDA',
'title' => 'Yenilikçi Teknoloji <span class="text-[#e31e24]">Çözümleri</span>',
'subtitle' => '2010 yılından bu yana dijital dönüşüm süreçlerinde lider konumdayız',
],
],
[
'type' => 'features',
'data' => [
'bg_class' => '!bg-[#ffffff]',
'section_title' => 'Değerlerimiz',
'section_subtitle' => 'İş süreçlerimizi şekillendiren temel prensiplerimiz',
'column_class' => 'md:w-6/12 lg:w-3/12',
'features' => [
['icon' => 'assets/img/demos/fi1.png', 'title' => 'İnovasyon', 'description' => 'Sürekli yenilik ve gelişim'],
['icon' => 'assets/img/demos/fi2.png', 'title' => 'Kalite', 'description' => 'En yüksek standartlarda hizmet'],
['icon' => 'assets/img/demos/fi3.png', 'title' => 'Güvenilirlik', 'description' => 'Zamanında ve eksiksiz teslimat'],
['icon' => 'assets/img/demos/fi4.png', 'title' => 'Destek', 'description' => '7/24 müşteri desteği'],
],
],
],
],
],
]
);
// Services Page
// 2.1 Hakkımızda (Child of Kurumsal)
Page::updateOrCreate(
['slug' => 'hakkimizda'],
[
'author_id' => $author->id,
'title' => 'Hizmetlerimiz',
'slug' => 'services',
'excerpt' => 'Geniş yelpazede teknoloji hizmetleri sunuyoruz',
'parent_id' => $corporate->id,
'title' => 'Hakkımızda',
'excerpt' => 'Biz kimiz?',
'content' => '<p>Hakkımızda içeriği...</p>',
'template' => 'generic',
'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(),
]
);
// 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',
@@ -165,152 +109,43 @@ class PageSeeder extends Seeder
'show_in_menu' => true,
'sort_order' => 3,
'published_at' => now(),
'meta_title' => 'Hizmetlerimiz - Truncgil Citrus',
'meta_description' => 'Web tasarım, mobil uygulama geliştirme, e-ticaret çözümleri ve dijital pazarlama hizmetlerimizi keşfedin.',
'sections' => [
[
'type' => 'hero',
'data' => [
'badge' => 'HİZMETLER',
'title' => 'Dijital Dönüşüm <span class="text-[#e31e24]">Çözümleri</span>',
'subtitle' => 'İşinizi bir üst seviyeye taşıyacak teknoloji hizmetlerimiz',
],
],
[
'type' => 'features',
'data' => [
'bg_class' => '!bg-[#f0f0f8]',
'section_title' => 'Sunduğumuz Hizmetler',
'column_class' => 'md:w-6/12 lg:w-4/12',
'features' => [
['icon' => 'assets/img/demos/fi1.png', 'title' => 'Web Tasarım & Geliştirme', 'description' => 'Modern, responsive ve SEO uyumlu web siteleri'],
['icon' => 'assets/img/demos/fi2.png', 'title' => 'Mobil Uygulama', 'description' => 'iOS ve Android için native ve cross-platform uygulamalar'],
['icon' => 'assets/img/demos/fi3.png', 'title' => 'E-Ticaret Çözümleri', 'description' => 'Entegre ödeme sistemleri ile online satış platformları'],
['icon' => 'assets/img/demos/fi4.png', 'title' => 'Dijital Pazarlama', 'description' => 'SEO, SEM ve sosyal medya yönetimi'],
['icon' => 'assets/img/demos/fi1.png', 'title' => 'Kurumsal Yazılım', 'description' => 'İşletmenize özel CRM, ERP ve özel yazılım çözümleri'],
['icon' => 'assets/img/demos/fi2.png', 'title' => 'Bulut Hizmetleri', 'description' => 'Güvenli ve ölçeklenebilir bulut altyapısı'],
],
],
],
],
],
]
);
// Contact Page
// 4. Blog
Page::updateOrCreate(
['slug' => 'blog'],
[
'author_id' => $author->id,
'title' => 'İletişim',
'slug' => 'contact',
'excerpt' => 'Projeleriniz hakkında bizimle iletişime geçin',
'title' => 'Blog',
'excerpt' => 'Güncel haberler ve makaleler',
'content' => null,
'template' => 'generic',
'template' => 'blog',
'status' => 'published',
'is_homepage' => false,
'show_in_menu' => true,
'sort_order' => 4,
'published_at' => now(),
'meta_title' => 'İletişim - Truncgil Citrus',
'meta_description' => 'Projeleriniz hakkında konuşmak için bizimle iletişime geçin. Uzman ekibimiz size yardımcı olmaktan mutluluk duyar.',
'sections' => [
[
'type' => 'hero',
'data' => [
'badge' => 'İLETİŞİM',
'title' => 'Projelerinizi <span class="text-[#e31e24]">Konuşalım</span>',
'subtitle' => 'Size özel çözümler geliştirmek için bizimle iletişime geçin',
],
],
[
'type' => 'contact',
'data' => [
'bg_class' => '!bg-[#f0f0f8]',
'title' => 'Bizimle İletişime Geçin',
'subtitle' => 'Projeleriniz hakkında konuşmak için bize ulaşın',
'info' => [
'address' => 'Merkez Mah. Teknoloji Cad. No:123 İstanbul',
'phone' => '+90 (212) 555 1234',
'email' => 'info@truncgil.com',
],
'form_action' => '/contact/submit',
'button_text' => 'Gönder',
],
],
],
],
]
);
// Pricing Page (örnek)
// 5. İletişim
Page::updateOrCreate(
['slug' => 'iletisim'],
[
'author_id' => $author->id,
'title' => 'Fiyatlandırma',
'slug' => 'pricing',
'excerpt' => 'Size uygun paketi seçin',
'title' => 'İletişim',
'excerpt' => 'Bize ulaşın',
'content' => null,
'template' => 'generic',
'template' => 'contact',
'status' => 'published',
'is_homepage' => false,
'show_in_menu' => false,
'show_in_menu' => true,
'sort_order' => 5,
'published_at' => now(),
'meta_title' => 'Fiyatlandırma - Truncgil Citrus',
'meta_description' => 'İhtiyaçlarınıza uygun web tasarım ve yazılım geliştirme paketlerimizi inceleyin.',
'sections' => [
[
'type' => 'hero',
'data' => [
'badge' => 'FİYATLANDIRMA',
'title' => 'Size Uygun <span class="text-[#e31e24]">Paketi Seçin</span>',
'subtitle' => 'Tüm paketler 30 gün para iade garantisi ile geliyor',
],
],
[
'type' => 'pricing',
'data' => [
'bg_class' => '!bg-[#f0f0f8]',
'section_title' => 'Web Tasarım Paketleri',
'column_class' => 'md:w-6/12 lg:w-4/12',
'featured_label' => 'Önerilen',
'plans' => [
[
'name' => 'Başlangıç',
'currency' => '₺',
'price' => '999',
'period' => 'ay',
'features' => ['5 Sayfa', 'Mobil Uyumlu', 'SEO Optimizasyonu', '7/24 Destek'],
'button_text' => 'Başla',
'button_url' => '/contact',
],
[
'name' => 'Profesyonel',
'currency' => '₺',
'price' => '2499',
'period' => 'ay',
'featured' => true,
'features' => ['15 Sayfa', 'Mobil Uyumlu', 'SEO Optimizasyonu', 'Yönetim Paneli', '7/24 Öncelikli Destek'],
'button_text' => 'Başla',
'button_url' => '/contact',
],
[
'name' => 'Kurumsal',
'currency' => '₺',
'price' => '4999',
'period' => 'ay',
'features' => ['Sınırsız Sayfa', 'Mobil Uyumlu', 'SEO Optimizasyonu', 'Gelişmiş Yönetim Paneli', 'Özel Entegrasyonlar', '7/24 Öncelikli Destek'],
'button_text' => 'Başla',
'button_url' => '/contact',
],
],
],
],
],
],
];
]
);
foreach ($pages as $pageData) {
Page::updateOrCreate(
['slug' => $pageData['slug']],
$pageData
);
}
$this->command->info('✅ ' . count($pages) . ' sayfa başarıyla oluşturuldu!');
$this->command->info('✅ Menu yapısı ve sayfalar başarıyla oluşturuldu!');
}
}