feat: implement full-stack awards module with Filament management, database support, and localization.

This commit is contained in:
Ümit Tunç
2026-05-27 06:32:31 +03:00
parent 05e8059b5d
commit 3c92a81cfe
14 changed files with 1127 additions and 0 deletions
@@ -0,0 +1,42 @@
<?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('awards', function (Blueprint $table) {
$table->id();
$table->string('title')->nullable(); // Original/fallback title
$table->text('description')->nullable(); // Original/fallback description
$table->string('issuer')->nullable(); // Original/fallback issuer
$table->date('award_date')->nullable();
$table->string('image')->nullable();
$table->string('external_link')->nullable();
$table->boolean('is_featured')->default(false);
$table->boolean('is_active')->default(true);
$table->unsignedInteger('sort_order')->default(0);
$table->string('category', 64)->default('general');
$table->timestamps();
$table->softDeletes();
$table->index(['is_active', 'sort_order']);
$table->index('is_featured');
$table->index('award_date');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('awards');
}
};
+100
View File
@@ -0,0 +1,100 @@
<?php
namespace Database\Seeders;
use App\Models\Award;
use Illuminate\Database\Seeder;
class AwardSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
$awards = [
[
'title' => 'Here & AWS & THY Hackathon Birinciliği',
'description' => '21 Mart 2019 yılında Here, Amazon Web Services (AWS) ve Türk Hava Yolları\'nın (THY) ortaklaşa yürüttüğü Hackathon kapsamında büyük bir başarı göstererek 1. lik ödülünü almaya hak kazandık.',
'issuer' => 'Here & AWS & THY',
'award_date' => '2019-03-21',
'image' => 'assets/img/awards/truncgil-hackathon-birincisi-here-aws-thy.png',
'external_link' => 'https://truncgil.com',
'is_featured' => true,
'is_active' => true,
'sort_order' => 1,
'category' => 'hackathon',
'translations' => [
'en' => [
'title' => 'Here & AWS & THY Hackathon First Place',
'description' => 'On March 21, 2019, we achieved outstanding success and won the 1st place award in the Hackathon jointly organized by Here, Amazon Web Services (AWS), and Turkish Airlines (THY).',
'issuer' => 'Here, AWS & Turkish Airlines',
]
],
],
[
'title' => 'Gaziantep Teknopark Yılın İhracat Ödülü',
'description' => 'İhracat faaliyetlerindeki üstün başarımızdan ötürü 26 Aralık 2019 yılında Gaziantep Teknopark tarafından "Yılın İhracat Ödülü"ne layık görüldük.',
'issuer' => 'Gaziantep Teknopark',
'award_date' => '2019-12-26',
'image' => 'assets/img/awards/truncgil-teknoloji-yilin-ihracat-odulu.png',
'external_link' => 'https://truncgil.com',
'is_featured' => true,
'is_active' => true,
'sort_order' => 2,
'category' => 'export',
'translations' => [
'en' => [
'title' => 'Gaziantep Technopark Export of the Year Award',
'description' => 'Due to our outstanding achievements in export activities, we were deemed worthy of the "Export of the Year Award" by Gaziantep Technopark on December 26, 2019.',
'issuer' => 'Gaziantep Technopark',
]
],
],
[
'title' => 'HackSmarCity Hackathon Birinciliği',
'description' => 'Gaziantep Teknopark, Target Teknoloji Transfer Ofisi, Gaziantep Büyükşehir Belediyesi ve Gaziantep Bilişim\'in ortaklaşa düzenlediği akıllı şehir çözümleri temalı HackSmarCity Hackathon\'unda 1. lik elde ettik.',
'issuer' => 'Gaziantep Büyükşehir Belediyesi & Teknopark',
'award_date' => '2019-11-15', // Approximate date in 2019/2020
'image' => 'assets/img/awards/truncgil-teknoloji-hacksmarcity.jpg',
'external_link' => 'https://truncgil.com',
'is_featured' => false,
'is_active' => true,
'sort_order' => 3,
'category' => 'hackathon',
'translations' => [
'en' => [
'title' => 'HackSmarCity Hackathon First Place',
'description' => 'We achieved 1st place in the HackSmarCity Hackathon themed around smart city solutions, jointly organized by Gaziantep Technopark, Target Technology Transfer Office, Gaziantep Metropolitan Municipality, and Gaziantep Bilisim.',
'issuer' => 'Gaziantep Metropolitan Municipality & Technopark',
]
],
],
];
foreach ($awards as $awardData) {
$translations = $awardData['translations'] ?? [];
unset($awardData['translations']);
$award = Award::updateOrCreate(
[
'award_date' => $awardData['award_date'],
'image' => $awardData['image'],
],
$awardData
);
// Save default (Turkish) translations in translation table too so HasTranslations resolves correctly
$award->setTranslation('title', 'tr', $awardData['title'], 'published');
$award->setTranslation('description', 'tr', $awardData['description'], 'published');
$award->setTranslation('issuer', 'tr', $awardData['issuer'], 'published');
// Save English translations
foreach ($translations as $langCode => $fields) {
foreach ($fields as $fieldName => $value) {
$award->setTranslation($fieldName, $langCode, $value, 'published');
}
}
}
}
}
+1
View File
@@ -27,6 +27,7 @@ class DatabaseSeeder extends Seeder
DekupaiProductSeeder::class,
FinanceProductSeeder::class,
BlogSeeder::class,
AwardSeeder::class,
]);
// User::factory(10)->create();
+18
View File
@@ -78,6 +78,24 @@ class PageSeeder extends Seeder
]
);
// 2.1.2 Ödüllerimiz (Child of Kurumsal)
Page::updateOrCreate(
['slug' => 'odullerimiz'],
[
'author_id' => $author->id,
'parent_id' => $corporate->id,
'title' => 'Ödüllerimiz',
'excerpt' => 'Yenilikçi teknolojilerimizle sektöre yön veriyor, başarılarimizi küresel ödüllerle taçlandırıyoruz.',
'content' => '<p>Yenilikçi teknolojilerimizle sektöre yön veriyor, başarılarimizi küresel ödüllerle taçlandırıyoruz.</p>',
'template' => 'odullerimiz',
'status' => 'published',
'is_homepage' => false,
'show_in_menu' => true,
'sort_order' => 6, // Sort order among Kurumsal children
'published_at' => now(),
]
);
// 2.2 Vizyon & Misyon (Child of Kurumsal)
Page::updateOrCreate(
['slug' => 'vizyon-misyon'],