Skip to content

Commit b25d021

Browse files
authored
Merge pull request #978 from dash8x/patch-1
Fixed IncludedCount.php
2 parents 342f30f + 59e3157 commit b25d021

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Includes/IncludedCount.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ class IncludedCount implements IncludeInterface
99
{
1010
public function __invoke(Builder $query, string $count)
1111
{
12-
$query->withCount(Str::before($count, config('query-builder.count_suffix', 'Count')));
12+
$suffix = config('query-builder.count_suffix', 'Count');
13+
$relation = Str::endsWith($count, $suffix) ? Str::beforeLast($count, $suffix) : $count;
14+
15+
$query->withCount($relation);
1316
}
1417
}

0 commit comments

Comments
 (0)