fix
This commit is contained in:
@@ -339,17 +339,17 @@ public function filters(Request $request)
|
|||||||
}
|
}
|
||||||
$caseSql .= "WHEN duration > {$this->durationOtherMin()} THEN '120-' END";
|
$caseSql .= "WHEN duration > {$this->durationOtherMin()} THEN '120-' END";
|
||||||
|
|
||||||
$durations = Media::select(
|
$durations = DB::table('media')
|
||||||
|
->select(
|
||||||
DB::raw("{$caseSql} as duration_range"),
|
DB::raw("{$caseSql} as duration_range"),
|
||||||
DB::raw('COUNT(*) as total')
|
DB::raw('COUNT(*) as total')
|
||||||
)
|
)
|
||||||
->whereNotNull('duration')
|
->where('duration', '>', 0) // every positive duration falls into a bucket
|
||||||
->where(function ($q) {
|
->where(function ($q) {
|
||||||
$q->where('visibility', 'public')
|
$q->where('visibility', 'public')
|
||||||
->orWhere('user_id', auth()->id());
|
->orWhere('user_id', auth()->id());
|
||||||
})
|
})
|
||||||
->groupBy('duration_range')
|
->groupBy('duration_range')
|
||||||
->havingRaw('duration_range IS NOT NULL')
|
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
|
|||||||
Reference in New Issue
Block a user