Add Language Management Module: Created Language resource with CRUD pages, schemas, and models to support the universal translation system. Implemented localization for English and Turkish, ensuring consistent user experience. Added necessary policies and seeder for initial language data, enhancing the overall language management functionality.
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Language;
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class LanguageSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$languages = [
|
||||
[
|
||||
'code' => 'tr',
|
||||
'name' => 'Turkish',
|
||||
'native_name' => 'Türkçe',
|
||||
'flag' => '🇹🇷',
|
||||
'direction' => 'ltr',
|
||||
'is_active' => true,
|
||||
'is_default' => true,
|
||||
'sort_order' => 1,
|
||||
],
|
||||
[
|
||||
'code' => 'en',
|
||||
'name' => 'English',
|
||||
'native_name' => 'English',
|
||||
'flag' => '🇬🇧',
|
||||
'direction' => 'ltr',
|
||||
'is_active' => true,
|
||||
'is_default' => false,
|
||||
'sort_order' => 2,
|
||||
],
|
||||
[
|
||||
'code' => 'de',
|
||||
'name' => 'German',
|
||||
'native_name' => 'Deutsch',
|
||||
'flag' => '🇩🇪',
|
||||
'direction' => 'ltr',
|
||||
'is_active' => false,
|
||||
'is_default' => false,
|
||||
'sort_order' => 3,
|
||||
],
|
||||
[
|
||||
'code' => 'fr',
|
||||
'name' => 'French',
|
||||
'native_name' => 'Français',
|
||||
'flag' => '🇫🇷',
|
||||
'direction' => 'ltr',
|
||||
'is_active' => false,
|
||||
'is_default' => false,
|
||||
'sort_order' => 4,
|
||||
],
|
||||
[
|
||||
'code' => 'ar',
|
||||
'name' => 'Arabic',
|
||||
'native_name' => 'العربية',
|
||||
'flag' => '🇸🇦',
|
||||
'direction' => 'rtl',
|
||||
'is_active' => false,
|
||||
'is_default' => false,
|
||||
'sort_order' => 5,
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($languages as $language) {
|
||||
Language::updateOrCreate(
|
||||
['code' => $language['code']],
|
||||
$language
|
||||
);
|
||||
}
|
||||
|
||||
$this->command->info('Languages seeded successfully!');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user