We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 342f30f + 59e3157 commit b25d021Copy full SHA for b25d021
src/Includes/IncludedCount.php
@@ -9,6 +9,9 @@ class IncludedCount implements IncludeInterface
9
{
10
public function __invoke(Builder $query, string $count)
11
12
- $query->withCount(Str::before($count, config('query-builder.count_suffix', 'Count')));
+ $suffix = config('query-builder.count_suffix', 'Count');
13
+ $relation = Str::endsWith($count, $suffix) ? Str::beforeLast($count, $suffix) : $count;
14
+
15
+ $query->withCount($relation);
16
}
17
0 commit comments