File tree 1 file changed +10
-13
lines changed
1 file changed +10
-13
lines changed Original file line number Diff line number Diff line change @@ -330,21 +330,18 @@ public function scopeNeverQualified($query)
330
330
331
331
public function scopeWithPackTags (Builder $ query ): Builder
332
332
{
333
- $ idColumn = $ this ->qualifyColumn ('beatmapset_id ' );
334
- $ packTagColumn = (new BeatmapPack ())->qualifyColumn ('tag ' );
335
- $ packItemBeatmapsetIdColumn = (new BeatmapPackItem ())->qualifyColumn ('beatmapset_id ' );
336
333
$ packQuery = BeatmapPack
337
- ::selectRaw ("GROUP_CONCAT( {$ packTagColumn } SEPARATOR ',') " )
338
- ->default ()
339
- ->whereRelation (
334
+ ::default ()
335
+ ->whereHas (
340
336
'items ' ,
341
- DB ::raw ($ packItemBeatmapsetIdColumn ),
342
- DB ::raw ($ idColumn ),
343
- )->toRawSql ();
344
-
345
- return $ query
346
- ->select ('* ' )
347
- ->selectRaw ("( {$ packQuery }) as pack_tags " );
337
+ fn ($ q ) => $ q ->whereColumn (
338
+ $ q ->qualifyColumn ('beatmapset_id ' ),
339
+ $ this ->qualifyColumn ('beatmapset_id ' )
340
+ ),
341
+ );
342
+ $ packQuery ->selectRaw ("GROUP_CONCAT( {$ packQuery ->qualifyColumn ('tag ' )} SEPARATOR ',') " );
343
+
344
+ return $ query ->addSelect (['pack_tags ' => $ packQuery ]);
348
345
}
349
346
350
347
public function scopeWithStates ($ query , $ states )
You can’t perform that action at this time.
0 commit comments