feat: implement Company History module with CRUD functionality, localization support, and timeline display for enhanced user experience

This commit is contained in:
Ümit Tunç
2026-05-21 19:33:38 +03:00
parent a9d6f17e3c
commit c82dd5c6b6
17 changed files with 1271 additions and 2 deletions
@@ -0,0 +1,39 @@
<?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('company_history_items', function (Blueprint $table) {
$table->id();
$table->unsignedSmallInteger('year');
$table->string('title');
$table->text('content');
$table->string('color', 7)->default('#17a2b8');
$table->string('icon', 64)->default('heroicon-o-building-office-2');
$table->enum('position', ['left', 'right'])->nullable();
$table->boolean('is_active')->default(true);
$table->unsignedInteger('sort_order')->default(0);
$table->timestamps();
$table->softDeletes();
$table->index(['is_active', 'sort_order']);
$table->index('year');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('company_history_items');
}
};
@@ -0,0 +1,118 @@
<?php
namespace Database\Seeders;
use App\Models\CompanyHistoryItem;
use Illuminate\Database\Seeder;
class CompanyHistoryItemSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
$items = [
[
'year' => 2014,
'title' => 'Kuruluş',
'content' => 'Trunçgil Teknoloji, 2014 yılında Ümit Tunç tarafından Gaziantep\'te kuruldu.',
'color' => '#17a2b8',
'icon' => 'heroicon-o-building-office-2',
'sort_order' => 1,
'translations' => [
'en' => [
'title' => 'Foundation',
'content' => 'Trunçgil Technology was founded in Gaziantep in 2014 by Ümit Tunç.',
],
],
],
[
'year' => 2015,
'title' => 'Akademik Altyapı',
'content' => 'E-SER akademik yayın evil ile çözüm ortaklığı yaparak akademik camiada indeksli dergilerin alt yapısını geliştirdi.',
'color' => '#f5a623',
'icon' => 'heroicon-o-academic-cap',
'sort_order' => 2,
'translations' => [
'en' => [
'title' => 'Academic Infrastructure',
'content' => 'Developed the infrastructure for indexed journals in academia through a solution partnership with E-SER academic publishing.',
],
],
],
[
'year' => 2016,
'title' => 'İlk İhracat',
'content' => 'İlk ihracatını gerçekleştirerek e-ticaret alanında Amerika\'nın New Jersey eyaletinde faaliyetler sürdürdü.',
'color' => '#e91e63',
'icon' => 'heroicon-o-globe-alt',
'sort_order' => 3,
'translations' => [
'en' => [
'title' => 'First Export',
'content' => 'Carried out its first export and continued operations in e-commerce in New Jersey, United States.',
],
],
],
[
'year' => 2017,
'title' => 'TRDoktor.com',
'content' => 'TRDoktor.com ile işbirliği neticesinde Türkiye genelinde aylık bir milyondan daha fazla ziyaretçiye kapı açtı.',
'color' => '#2c3e50',
'icon' => 'heroicon-o-users',
'sort_order' => 4,
'translations' => [
'en' => [
'title' => 'TRDoktor.com',
'content' => 'Through collaboration with TRDoktor.com, opened its doors to more than one million monthly visitors across Turkey.',
],
],
],
[
'year' => 2018,
'title' => 'Eğitim Teknolojileri',
'content' => 'Amerikan Kültür Koleji\'nin eğitim alt yapısında kullanılan uygulamalar geliştirdi.',
'color' => '#5dade2',
'icon' => 'heroicon-o-academic-cap',
'sort_order' => 5,
'translations' => [
'en' => [
'title' => 'Education Technology',
'content' => 'Developed applications used in the educational infrastructure of American Culture College.',
],
],
],
[
'year' => 2019,
'title' => 'Teknopark ve Hackathon',
'content' => 'Gaziantep Teknopark şubesini açtı. Aynı yıl Almanya menşeli HERE harita sistemlerinin gerçekleştirildiği ulusal Hackathon birinciliği elde etti.',
'color' => '#27ae60',
'icon' => 'heroicon-o-trophy',
'sort_order' => 6,
'translations' => [
'en' => [
'title' => 'Technopark & Hackathon',
'content' => 'Opened its Gaziantep Technopark branch. The same year, won first place in the national hackathon implementing HERE map systems from Germany.',
],
],
],
];
foreach ($items as $itemData) {
$translations = $itemData['translations'] ?? [];
unset($itemData['translations']);
$item = CompanyHistoryItem::updateOrCreate(
['year' => $itemData['year'], 'sort_order' => $itemData['sort_order']],
array_merge($itemData, ['is_active' => true, 'position' => null])
);
foreach ($translations as $langCode => $fields) {
foreach ($fields as $fieldName => $value) {
$item->setTranslation($fieldName, $langCode, $value, 'published');
}
}
}
}
}
+1
View File
@@ -18,6 +18,7 @@ class DatabaseSeeder extends Seeder
LanguageSeeder::class,
SettingSeeder::class,
PageSeeder::class,
CompanyHistoryItemSeeder::class,
]);
// User::factory(10)->create();
+2 -2
View File
@@ -67,8 +67,8 @@ class PageSeeder extends Seeder
'parent_id' => $corporate->id,
'title' => 'Hakkımızda',
'excerpt' => 'Biz kimiz?',
'content' => '<p>Hakkımızda içeriği...</p>',
'template' => 'generic',
'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,