From 36086a087c9989a1cd0b365051f310e05b94debe Mon Sep 17 00:00:00 2001 From: Roardom Date: Sun, 23 Mar 2025 23:07:57 +0000 Subject: [PATCH] fix: edit request page There's an defined variable here from a copy-paste error that forgot to include the rest of the alpinejs logic. --- app/Http/Controllers/RequestController.php | 17 ++++++++++++++++- resources/views/requests/edit.blade.php | 20 +++++++++++++------- resources/views/torrent/edit.blade.php | 2 +- 3 files changed, 30 insertions(+), 9 deletions(-) diff --git a/app/Http/Controllers/RequestController.php b/app/Http/Controllers/RequestController.php index 8c5990b3f..84a0c944b 100644 --- a/app/Http/Controllers/RequestController.php +++ b/app/Http/Controllers/RequestController.php @@ -174,7 +174,22 @@ class RequestController extends Controller public function edit(Request $request, TorrentRequest $torrentRequest): \Illuminate\Contracts\View\Factory|\Illuminate\View\View { return view('requests.edit', [ - 'categories' => Category::orderBy('position')->get(), + 'categories' => Category::query() + ->orderBy('position') + ->get() + ->mapWithKeys(fn ($cat) => [ + $cat['id'] => [ + 'name' => $cat['name'], + 'type' => match (true) { + $cat->movie_meta => 'movie', + $cat->tv_meta => 'tv', + $cat->game_meta => 'game', + $cat->music_meta => 'music', + $cat->no_meta => 'no', + default => 'no', + }, + ] + ]), 'types' => Type::orderBy('position')->get(), 'resolutions' => Resolution::orderBy('position')->get(), 'user' => $request->user(), diff --git a/resources/views/requests/edit.blade.php b/resources/views/requests/edit.blade.php index 411df3d25..ca6bd1bdf 100644 --- a/resources/views/requests/edit.blade.php +++ b/resources/views/requests/edit.blade.php @@ -30,7 +30,7 @@
@@ -57,15 +57,21 @@

- + + @foreach ($categories as $id => $category) @endforeach diff --git a/resources/views/torrent/edit.blade.php b/resources/views/torrent/edit.blade.php index a9d54fc8a..669a91e2d 100644 --- a/resources/views/torrent/edit.blade.php +++ b/resources/views/torrent/edit.blade.php @@ -86,7 +86,7 @@ {{ $torrent->category->name }} ({{ __('torrent.current') }}) @foreach ($categories as $id => $category) - @endforeach