multilanguage updated
This commit is contained in:
1 parent
027d1090df
commit
6c834607bd
12 files changed
+299
-25
No files matched your search
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders\Website;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use App\Models\Website\Project;
|
||||
use App\Models\Website\ProjectTranslation;
|
||||
use App\Models\Website\ProjectCategory;
|
||||
|
||||
class ProjectSeeder extends Seeder
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
// دریافت تمام دستهبندیها
|
||||
$categories = ProjectCategory::all();
|
||||
|
||||
foreach ($categories as $category) {
|
||||
// ایجاد تعداد تصادفی پروژه برای هر دستهبندی
|
||||
$projectCount = rand(5, 10);
|
||||
|
||||
for ($i = 1; $i <= $projectCount; $i++) {
|
||||
// ایجاد پروژه جدید
|
||||
$project = Project::create([
|
||||
'category_id' => $category->id,
|
||||
'image1' => 'project' . $i . '_image1.jpg',
|
||||
'image2' => 'project' . $i . '_image2.jpg'
|
||||
]);
|
||||
|
||||
// ایجاد ترجمهها
|
||||
ProjectTranslation::create([
|
||||
'project_id' => $project->id,
|
||||
'locale' => 'fa',
|
||||
'title' => 'پروژه ' . $i . ' - ' . $category->translations()->where('locale', 'fa')->first()->title,
|
||||
'description' => 'توضیحات پروژه ' . $i . ' برای دستهبندی ' . $category->translations()->where('locale', 'fa')->first()->title,
|
||||
]);
|
||||
|
||||
ProjectTranslation::create([
|
||||
'project_id' => $project->id,
|
||||
'locale' => 'en',
|
||||
'title' => 'Project ' . $i . ' - ' . $category->translations()->where('locale', 'en')->first()->title,
|
||||
'description' => 'Description for project ' . $i . ' in category ' . $category->translations()->where('locale', 'en')->first()->title,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user