v9 - Tenant Tema Degistirme Eklendi

t-{id} Tema Yapisi

Multi-Tenant Tema Sistemi - Tenant Tema, Logo Kurallari, Layout, Dark Mode

1. Felsefe

t-{id} = Tenant temasi. Sadece ozel dosyalar burada.

simple = Fallback (mevcut, zaten var). t-{id}'de yoksa buradan alir.

Ornek: t-3/homepage.blade.php var -> onu kullan, t-3/blog/show.blade.php yok -> simple'dan al

2. Tenant Tema Degistirme

YENI v9

Basit Anlatim

Tenant'in hangi temayi kullanacagi central veritabanindaki tenants tablosunda belirlenir. data JSON kolonuna tema adi yazilir.

themes Tablosu (Central DB)

-- Mevcut temalar
SELECT theme_id, name, folder_name FROM themes;

+----------+--------+-------------+
| theme_id | name   | folder_name |
+----------+--------+-------------+
| 1        | simple | simple      |  ← Fallback
| 8        | panjur | panjur      |
| 9        | t-3    | t-3         |  ← Panjur icin
+----------+--------+-------------+

Tenant'a Tema Atama (Central DB)

-- Tenant 3'e t-3 temasini ata
UPDATE tenants
SET data = '{"theme": "t-3"}'
WHERE id = 3;

-- Kontrol
SELECT id, data FROM tenants WHERE id = 3;
+----+------------------+
| id | data             |
+----+------------------+
| 3  | {"theme": "t-3"} |
+----+------------------+

Tema Degisikliginden Sonra

php artisan cache:clear
php artisan view:clear
php artisan responsecache:clear

ONEMLI

  • Tema ayari tenant veritabaninda degil, central'da
  • JSON formati: {"theme": "tema-adi"}
  • Tema klasoru: resources/views/themes/{tema-adi}/

3. Klasor Yapisi

resources/views/themes/
|
+-- simple/                         ← FALLBACK (mevcut, dokunma)
|   +-- layouts/
|   +-- homepage.blade.php
|
+-- t-1001/                         ← Muzibu
+-- t-2/                            ← Ixtif
+-- t-3/                            ← Panjur
    +-- layouts/
    |   +-- app.blade.php           (Ana layout)
    |   +-- header.blade.php        (Header)
    |   +-- footer.blade.php        (Footer)
    +-- homepage.blade.php          (STANDALONE)

ONEMLI: Modul view'lari AYRI konumda! "Modul View Path'leri" bolumune bak.

4. Layout Sistemi (Her Temada Olmali!)

Basit Anlatim

Her temanin kendi header ve footer'i olmali. Fallback degil, temaya ozel.

KURAL: Fallback Header/Footer YOK!

Her tema kendi layouts/header.blade.php ve layouts/footer.blade.php dosyasina sahip olmali.

Container Padding Standardi

{{-- TUM sayfalarda ayni padding kullan --}}
<div class="container mx-auto px-4 sm:px-6 md:px-8 lg:px-12 xl:px-16 2xl:px-20">
    ...
</div>

6. Service/Page Tasarim Pattern

Minimal Subheader

{{-- MINIMAL SUBHEADER - Sadece breadcrumb + title --}}
<section class="bg-gray-50 dark:bg-gray-800 border-b py-4">
    <nav>Breadcrumb</nav>
    <h1 class="text-2xl md:text-3xl font-bold">{{ $title }}</h1>
</section>

Kare Kart Pattern

{{-- Kare gorsel + gradient + beyaz yazi --}}
<a class="group relative aspect-square rounded-xl overflow-hidden">
    <img class="w-full h-full object-cover group-hover:scale-105">
    <div class="absolute inset-0 bg-gradient-to-t from-black/70"></div>
    <h2 class="text-white">{{ $title }}</h2>
</a>

// DIKKAT: hover:-translate-y-2 KULLANMA (ziplamasin!)

7. Settings Kullanim Kurallari

YASAK: Fallback Degerler

// YANLIS - YAPMA!
$siteName = setting('site_name') ?: 'Varsayilan Ad';

DOGRU: Kosullu Gosterim

@if($sitePhone)
<a href="tel:{{ $sitePhone }}">{{ $sitePhone }}</a>
@endif

8. Dark/Light Mode

1. FOUC Onleme (head icinde)

<script>
    if (localStorage.getItem('darkMode') === 'true' ||
        (!localStorage.getItem('darkMode') &&
         window.matchMedia('(prefers-color-scheme: dark)').matches)) {
        document.documentElement.classList.add('dark');
    }
</script>

2. Alpine.js Body (DOGRU)

<body x-data="{
          darkMode: localStorage.getItem('darkMode') === 'true' ||
                   (!localStorage.getItem('darkMode') &&
                    window.matchMedia('(prefers-color-scheme: dark)').matches),
          mobileMenu: false
      }"
      x-init="
          document.documentElement.classList.toggle('dark', darkMode);
          $watch('darkMode', val => {
              localStorage.setItem('darkMode', val);
              document.documentElement.classList.toggle('dark', val);
          });
      ">

9. Modul View Path'leri

GUNCELLENDI v9

KRITIK: Modul Onceligi!

Laravel once Modules/ altindaki view'lara bakar, sonra resources/views/'a. Homepage icin her iki konumu da guncelle!

Homepage.blade.php (IKI KONUM!)

1. MODUL KONUMU (ONCELIKLI!):
Modules/Page/resources/views/themes/t-3/homepage.blade.php

2. RESOURCES KONUMU:
resources/views/themes/t-3/homepage.blade.php

// UYARI: Degisiklik yapacaksan HER IKISINDE de yap!
// Modules/ altindaki ONCELIKLI olarak yuklenir.

Tum Modul View Konumlari

Modules/Page/resources/views/themes/
+-- simple/homepage.blade.php      ← Fallback
+-- t-3/homepage.blade.php         ← Panjur (BURASI ONCELIKLI!)

Modules/Service/resources/views/themes/
+-- simple/index.blade.php         ← Fallback (tum tenantlar)
+-- simple/show.blade.php

Modules/Blog/resources/views/themes/
+-- simple/blog/index.blade.php
+-- simple/blog/show.blade.php

Tip: Service/Blog icin t-3 ozel view yok, simple fallback kullaniliyor. Ozel tasarim istersen Modules/Service/resources/views/themes/t-3/ olustur.

Yeni Tema Checklist