From 059e97bdd7f479cae1cdf825f3e851c8d1580817 Mon Sep 17 00:00:00 2001 From: AmirmahdiNourkazemi Date: Tue, 16 Jun 2026 13:29:12 +0330 Subject: [PATCH] fix --- app/Http/Controllers/MediaController.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/MediaController.php b/app/Http/Controllers/MediaController.php index 00b463d..ab41838 100644 --- a/app/Http/Controllers/MediaController.php +++ b/app/Http/Controllers/MediaController.php @@ -339,17 +339,17 @@ public function filters(Request $request) } $caseSql .= "WHEN duration > {$this->durationOtherMin()} THEN '120-' END"; - $durations = Media::select( + $durations = DB::table('media') + ->select( DB::raw("{$caseSql} as duration_range"), DB::raw('COUNT(*) as total') ) - ->whereNotNull('duration') + ->where('duration', '>', 0) // every positive duration falls into a bucket ->where(function ($q) { $q->where('visibility', 'public') ->orWhere('user_id', auth()->id()); }) ->groupBy('duration_range') - ->havingRaw('duration_range IS NOT NULL') ->get(); return response()->json([