fixed tenants and eventpurchaseresource, changed lightbox in gallery

This commit is contained in:
2025-09-18 15:27:33 +02:00
parent 60f5e46ea9
commit ef6203c603
15 changed files with 440 additions and 118 deletions

View File

@@ -0,0 +1,70 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
return new class extends Migration
{
public function up(): void
{
DB::table('tenants')
->select('id', 'name')
->orderBy('id')
->chunkById(100, function ($tenants): void {
foreach ($tenants as $tenant) {
$raw = $tenant->name;
if ($raw === null || $raw === '') {
continue;
}
$decoded = json_decode($raw, true);
$value = $raw;
if (json_last_error() === JSON_ERROR_NONE && is_array($decoded)) {
$preferred = $decoded['de'] ?? $decoded['en'] ?? null;
if ($preferred === null) {
foreach ($decoded as $entry) {
if (is_string($entry) && $entry !== '') {
$preferred = $entry;
break;
}
}
}
$value = $preferred ?? (string) $raw;
}
DB::table('tenants')->where('id', $tenant->id)->update([
'name' => (string) $value,
]);
}
});
}
public function down(): void
{
DB::table('tenants')
->select('id', 'name')
->orderBy('id')
->chunkById(100, function ($tenants): void {
foreach ($tenants as $tenant) {
$raw = $tenant->name;
if ($raw === null || $raw === '') {
continue;
}
$localized = json_encode([
'de' => $raw,
'en' => $raw,
], JSON_UNESCAPED_UNICODE);
DB::table('tenants')->where('id', $tenant->id)->update([
'name' => $localized,
]);
}
});
}
};