10-04-2026
This commit is contained in:
parent
4d6b4930b2
commit
4bb89aad8c
836 changed files with 52961 additions and 5950 deletions
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use FluxCms\Core\Models\CmsIndustry;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class CmsIndustrySeeder extends Seeder
|
||||
{
|
||||
public function run(): void
|
||||
{
|
||||
$locales = ['de', 'en'];
|
||||
$industriesByLocale = [];
|
||||
|
||||
foreach ($locales as $locale) {
|
||||
$path = lang_path("{$locale}/components.php");
|
||||
if (file_exists($path)) {
|
||||
$data = require $path;
|
||||
$industriesByLocale[$locale] = $data['industries_band']['industries'] ?? [];
|
||||
}
|
||||
}
|
||||
|
||||
$deIndustries = $industriesByLocale['de'] ?? [];
|
||||
$enIndustries = $industriesByLocale['en'] ?? [];
|
||||
|
||||
$maxCount = max(count($deIndustries), count($enIndustries));
|
||||
|
||||
for ($i = 0; $i < $maxCount; $i++) {
|
||||
CmsIndustry::updateOrCreate(
|
||||
['order' => $i],
|
||||
[
|
||||
'name' => array_filter([
|
||||
'de' => $deIndustries[$i] ?? null,
|
||||
'en' => $enIndustries[$i] ?? null,
|
||||
]),
|
||||
'is_published' => true,
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue