diff --git a/app/Filament/Admin/Resources/SiteTranslations/Pages/CreateSiteTranslation.php b/app/Filament/Admin/Resources/SiteTranslations/Pages/CreateSiteTranslation.php new file mode 100644 index 0000000..6bd66c7 --- /dev/null +++ b/app/Filament/Admin/Resources/SiteTranslations/Pages/CreateSiteTranslation.php @@ -0,0 +1,12 @@ +get(); + + $translationFields = []; + foreach ($languages as $language) { + $translationFields[] = Textarea::make($language->code) + ->label($language->name . " ({$language->code})") + ->rows(2); + } + + return $schema + ->components([ + Section::make() + ->schema([ + Textarea::make('key') + ->label('Key / Original Text') + ->required() + ->columnSpanFull() + ->helperText('The original text to be translated. Use this exact text in t() helper.'), + + Group::make() + ->schema($translationFields) + ->statePath('translations') + ->columnSpanFull(), + ]) + ]); + } +} + diff --git a/app/Filament/Admin/Resources/SiteTranslations/SiteTranslationResource.php b/app/Filament/Admin/Resources/SiteTranslations/SiteTranslationResource.php new file mode 100644 index 0000000..e9c14f0 --- /dev/null +++ b/app/Filament/Admin/Resources/SiteTranslations/SiteTranslationResource.php @@ -0,0 +1,67 @@ + Pages\ListSiteTranslations::route('/'), + 'create' => Pages\CreateSiteTranslation::route('/create'), + 'edit' => Pages\EditSiteTranslation::route('/{record}/edit'), + ]; + } + + public static function getNavigationLabel(): string + { + return __('Site Translations'); + } + + public static function getModelLabel(): string + { + return __('Translation'); + } + + public static function getPluralModelLabel(): string + { + return __('Translations'); + } +} + diff --git a/app/Filament/Admin/Resources/SiteTranslations/Tables/SiteTranslationsTable.php b/app/Filament/Admin/Resources/SiteTranslations/Tables/SiteTranslationsTable.php new file mode 100644 index 0000000..62cf299 --- /dev/null +++ b/app/Filament/Admin/Resources/SiteTranslations/Tables/SiteTranslationsTable.php @@ -0,0 +1,52 @@ +getLocale(); + + return $table + ->columns([ + TextColumn::make('key') + ->searchable() + ->sortable() + ->limit(50) + ->wrap(), + + TextColumn::make("translations.{$defaultLocale}") + ->label("Translation ({$defaultLocale})") + ->searchable() + ->limit(50) + ->wrap() + ->placeholder('No translation'), + + TextColumn::make('created_at') + ->dateTime() + ->sortable() + ->toggleable(isToggledHiddenByDefault: true), + ]) + ->filters([ + // + ]) + ->recordActions([ + EditAction::make(), + DeleteAction::make(), + ]) + ->toolbarActions([ + BulkActionGroup::make([ + DeleteBulkAction::make(), + ]), + ]); + } +} + diff --git a/app/Helpers/setting_helpers.php b/app/Helpers/setting_helpers.php index 7aeda23..70611c2 100644 --- a/app/Helpers/setting_helpers.php +++ b/app/Helpers/setting_helpers.php @@ -1,6 +1,8 @@ where('is_active', true) + ->first(); + }); + + if (!$setting) { + return $default; + } + + $value = $setting->value; + + // Handle file/image types + if (in_array($setting->type, ['file', 'image']) || $key === 'home_hero') { + if (empty($value)) { + return $default; + } + + // If value is already a URL, return it + if (filter_var($value, FILTER_VALIDATE_URL)) { + return $value; + } + + // Return storage URL + return Storage::url($value); + } + + return $value; } } - diff --git a/app/Helpers/translation_helpers.php b/app/Helpers/translation_helpers.php index 02dee5d..36fad85 100644 --- a/app/Helpers/translation_helpers.php +++ b/app/Helpers/translation_helpers.php @@ -2,6 +2,7 @@ use App\Models\Language; use App\Models\Translation; +use App\Models\SiteTranslation; use Illuminate\Support\Collection; if (!function_exists('current_language')) { @@ -279,3 +280,19 @@ if (!function_exists('get_translation_value')) { } } +if (!function_exists('t')) { + /** + * Get site translation for a given key. + * + * @param string $key + * @return string + */ + function t(string $key): string + { + if (empty($key)) { + return ''; + } + return SiteTranslation::getTranslation($key); + } +} + diff --git a/app/Models/SiteTranslation.php b/app/Models/SiteTranslation.php new file mode 100644 index 0000000..dca98f4 --- /dev/null +++ b/app/Models/SiteTranslation.php @@ -0,0 +1,77 @@ + 'array', + ]; + + protected static function boot() + { + parent::boot(); + + static::creating(function ($model) { + if (empty($model->hash)) { + $model->hash = md5($model->key); + } + }); + + static::updating(function ($model) { + // Key değiştiyse hash'i güncelle + if ($model->isDirty('key')) { + $model->hash = md5($model->key); + } + }); + + static::saved(function ($model) { + Cache::forget("site_translation_{$model->hash}"); + }); + } + + /** + * Get translation for a specific key + */ + public static function getTranslation(string $key): string + { + $hash = md5($key); + $locale = app()->getLocale(); + + // Cache'ten veya DB'den al + // Cache süresi: 24 saat + $translation = Cache::remember("site_translation_{$hash}", 60 * 60 * 24, function () use ($hash, $key) { + return static::firstOrCreate( + ['hash' => $hash], + ['key' => $key] + ); + }); + + // Eğer kayıt yeni oluşturulduysa ve key eksikse (concurrency nedeniyle), key'i set et + if ($translation->wasRecentlyCreated && empty($translation->translations)) { + // Yeni oluşturuldu, henüz çeviri yok. + // Varsayılan olarak key'i döndür. + return $key; + } + + $translations = $translation->translations ?? []; + + if (isset($translations[$locale]) && !empty($translations[$locale])) { + return $translations[$locale]; + } + + return $key; + } +} diff --git a/database/migrations/2025_12_30_200034_create_site_translations_table.php b/database/migrations/2025_12_30_200034_create_site_translations_table.php new file mode 100644 index 0000000..9340b59 --- /dev/null +++ b/database/migrations/2025_12_30_200034_create_site_translations_table.php @@ -0,0 +1,30 @@ +id(); + $table->string('hash')->unique()->index(); // MD5 hash of the key + $table->text('key'); // Original text + $table->json('translations')->nullable(); // JSON data: {"en": "...", "tr": "..."} + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('site_translations'); + } +}; diff --git a/public/assets/img/truncgil/truncgil-hero.png b/public/assets/img/truncgil/truncgil-hero.png new file mode 100644 index 0000000..61ef914 Binary files /dev/null and b/public/assets/img/truncgil/truncgil-hero.png differ diff --git a/resources/views/front/home.blade.php b/resources/views/front/home.blade.php deleted file mode 100644 index f7ec14b..0000000 --- a/resources/views/front/home.blade.php +++ /dev/null @@ -1,245 +0,0 @@ -@extends('layouts.front') - -@section('title', 'Anasayfa - Trunçgil Teknoloji') - -@section('content') -
-
-
-
-

İşinizi Büyütün Pazarlama Çözümlerimizle

-

Müşterilerimizin web sitesi trafiğini, sıralamasını ve görünürlüğünü artırmalarına yardımcı oluyoruz.

- - -
- -
- image -
- -
- -
- -
image
-
- - -
-
-
-
-

Ne Yapıyoruz?

-

Sunduğumuz tam hizmet, işletmenizin ihtiyaçlarını karşılamak için özel olarak tasarlanmıştır.

-
- -
- -
- -
-
- -

SEO Hizmetleri

-

Web sitenizin görünürlüğünü artırmak için profesyonel SEO hizmetleri sunuyoruz.

- Daha Fazla -
-
- -
-
- -

Web Tasarım

-

Modern ve kullanıcı dostu web tasarımları ile markanızı öne çıkarın.

- Daha Fazla -
-
- -
-
- -

Sosyal Medya

-

Sosyal medya yönetimi ile hedef kitlenizle etkileşimi artırın.

- Daha Fazla -
-
- -
-
- -

Uygulama Geliştirme

-

iOS ve Android için özel mobil uygulamalar geliştiriyoruz.

- Daha Fazla -
-
-
- - - -
-
-
image
-
-
-

Neden Bizi Seçmelisiniz?

-

Değerli müşterilerimizin bizi tercih etmesinin birkaç nedeni.

- -
-
-
-
- -
-
-

Yaratıcılık

-

Özgün ve yaratıcı çözümler.

-
-
-
-
-
-
- -
-
-

Yenilikçi Düşünce

-

Geleceği şekillendiren fikirler.

-
-
-
-
-
-
- -
-
-

Hızlı Çözümler

-

Zamanında teslimat ve hızlı destek.

-
-
-
-
-
-
- -
-
-

Üstün Destek

-

7/24 müşteri memnuniyeti odaklı destek.

-
-
-
-
-
-
- - -
-
-
image
-
-
-

Çözümlerimiz

-

Siz arkanıza yaslanın, iş ihtiyaçlarınızı biz halledelim.

-

Yaratıcı ve yenilikçi çözümlerimizle işletmenizi dijital dünyada öne çıkarıyoruz. Sektördeki deneyimimiz ve uzman ekibimizle, hedeflerinize ulaşmanız için yanınızdayız.

-
-
-

99.7%

-
Müşteri Memnuniyeti
- -
-
-

4x

-
Yeni Ziyaretçi
- -
-
-
-
- -
-
-

Fiyatlandırma

-

Harika ve premium fiyatlar sunuyoruz.

-

30 günlük ücretsiz deneme ile tam hizmeti deneyimleyin. Kredi kartı gerekmez!

- Tüm Fiyatları Gör -
-
-
-
-
-
-
-
499 ay
-
-

Premium Paket

-
    -
  • 5 Proje
  • -
  • 100K API Erişimi
  • -
  • 200MB Depolama
  • -
  • Haftalık Raporlar
  • -
- Seç -
-
-
- -
-
-
- - -
-
-
image
-
-
-

Tanışalım

-

Birlikte harika işler başaralım. 5000+ müşterimiz bize güveniyor.

-

Projelerinizi hayata geçirmek, dijital dönüşümünüze katkıda bulunmak ve işinizi büyütmek için buradayız. Hemen bizimle iletişime geçin.

- Bize Katılın -
-
- -
-
- -
-
-
-
-

Şimdi Analiz Edin

-

Web sitenizin ne kadar hızlı olabileceğini merak ediyor musunuz? SEO Skorunuzu hemen kontrol edin.

-
-
-
-
-
-
- - - -
-
-
-
-
-
image
-
-@endsection diff --git a/resources/views/templates/home.blade.php b/resources/views/templates/home.blade.php index c62cd44..4d999b8 100644 --- a/resources/views/templates/home.blade.php +++ b/resources/views/templates/home.blade.php @@ -7,14 +7,14 @@
-

Grow Your Business with Our Marketing Solutions

-

We help our clients to increase their website traffic, rankings and visibility in search results.

- - +

{!! t('Grow Your Business with Our Marketing Solutions') !!}

+

{!! t('We help our clients to increase their website traffic, rankings and visibility in search results.') !!}

+ +
- image + image