Use redirect for random button to save database queries

This commit is contained in:
2025-10-09 12:55:24 +02:00
parent c034c94db5
commit 444feac1e0
4 changed files with 18 additions and 3 deletions

View File

@@ -67,8 +67,7 @@
@livewire('nav-live-search')
<div class="hidden lg:block pl-4">
<div class="flex flex-col items-center bg-gray-50/20 dark:bg-neutral-900/40 rounded-md">
@php $random = App\Models\Episode::inRandomOrder()->limit(1)->pluck('slug')->first(); @endphp
<a href="{{ route('hentai.index', ['title' => $random]) }}"
<a href="{{ route('hentai.random') }}"
class="cursor-pointer px-4 py-2 text-sm font-medium dark:hover:text-white text-gray-500 dark:text-white/90 focus:outline-none flex flex-col items-center md:flex-row">
<i class="fa-solid fa-shuffle"></i>
<p class="md:pl-1 pl-0">Random</p>