mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-03-17 02:20:58 -05:00
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.
This commit is contained in:
@@ -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(),
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
<section
|
||||
class="panelV2"
|
||||
x-data="{
|
||||
cat: {{ (int) $category_id }},
|
||||
cat: {{ (int) $torrentRequest->category_id }},
|
||||
cats: JSON.parse(atob('{{ base64_encode(json_encode($categories)) }}')),
|
||||
}"
|
||||
>
|
||||
@@ -57,15 +57,21 @@
|
||||
</label>
|
||||
</p>
|
||||
<p class="form__group">
|
||||
<select id="category_id" class="form__select" name="category_id" required>
|
||||
<option hidden selected disabled value=""></option>
|
||||
@foreach ($categories as $category)
|
||||
<select
|
||||
id="category_id"
|
||||
class="form__select"
|
||||
name="category_id"
|
||||
x-model="cat"
|
||||
required
|
||||
>
|
||||
<option hidden disabled selected value=""></option>
|
||||
@foreach ($categories as $id => $category)
|
||||
<option
|
||||
class="form__option"
|
||||
value="{{ $category->id }}"
|
||||
@selected($torrentRequest->category_id == $category->id)
|
||||
value="{{ $id }}"
|
||||
@selected($id === old('category_id', $torrentRequest->category_id))
|
||||
>
|
||||
{{ $category->name }}
|
||||
{{ $category['name'] }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
|
||||
@@ -86,7 +86,7 @@
|
||||
{{ $torrent->category->name }} ({{ __('torrent.current') }})
|
||||
</option>
|
||||
@foreach ($categories as $id => $category)
|
||||
<option value="{{ $id }}" @selected('category_id' === $id)>
|
||||
<option value="{{ $id }}" @selected(old('category_id') === $id)>
|
||||
{{ $category['name'] }}
|
||||
</option>
|
||||
@endforeach
|
||||
|
||||
Reference in New Issue
Block a user