This commit is contained in:
2025-09-18 15:31:27 +02:00
commit 2abba0c2b7
406 changed files with 31879 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
<?php
use App\Models\Episode;
use App\Models\Hentai;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
foreach (Hentai::all() as $hentai) {
$slugParts = explode('-', $hentai->slug);
$lastPart = $slugParts[array_key_last($slugParts)];
if (is_numeric($lastPart) && $lastPart < 1000) {
$slugParts[array_key_last($slugParts)] = 's'.$lastPart;
$newSlug = implode('-', $slugParts);
// Update hentai slug
$hentai->slug = $newSlug;
$hentai->save();
// Update episodes related to this hentai in bulk
Episode::where('hentai_id', $hentai->id)
->update(['slug' => DB::raw("CONCAT('$newSlug-', episode)")]);
}
}
}
};