From: Daniel Karbach Date: Thu, 21 Nov 2024 16:16:09 +0000 (+0100) Subject: additional channel filters X-Git-Url: https://git.localhorst.tv/?a=commitdiff_plain;h=HEAD;p=alttp.git additional channel filters --- diff --git a/app/Http/Controllers/ChannelController.php b/app/Http/Controllers/ChannelController.php index ae57e31..4de8baa 100644 --- a/app/Http/Controllers/ChannelController.php +++ b/app/Http/Controllers/ChannelController.php @@ -17,7 +17,9 @@ class ChannelController extends Controller { 'id' => 'array', 'id.*' => 'integer|numeric', 'joinable' => 'boolean|nullable', + 'joined' => 'boolean|nullable', 'limit' => 'numeric|nullable', + 'logging' => 'boolean|nullable', 'manageable' => 'boolean|nullable', 'phrase' => 'string|nullable', ]); @@ -34,6 +36,18 @@ class ChannelController extends Controller { if (isset($validatedData['joinable']) && $validatedData['joinable']) { $channels = $channels->where('twitch_chat', '!=', ''); } + if (isset($validatedData['joined'])) { + $channels = $channels->where('join', '=', !!$validatedData['joined']); + } + if (isset($validatedData['logging'])) { + if (!!$validatedData['logging']) { + $channels = $channels->where('chat', '=', true); + $channels = $channels->orWhere('join', '=', true); + } else { + $channels = $channels->where('chat', '=', false); + $channels = $channels->where('join', '=', false); + } + } if (isset($validatedData['manageable']) && $validatedData['manageable']) { $user = $request->user(); if (!$user) {