Skip to content

Commit

Permalink
Merge pull request #978 from dash8x/patch-1
Browse files Browse the repository at this point in the history
Fixed IncludedCount.php
  • Loading branch information
freekmurze authored Dec 11, 2024
2 parents 342f30f + 59e3157 commit b25d021
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Includes/IncludedCount.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ class IncludedCount implements IncludeInterface
{
public function __invoke(Builder $query, string $count)
{
$query->withCount(Str::before($count, config('query-builder.count_suffix', 'Count')));
$suffix = config('query-builder.count_suffix', 'Count');
$relation = Str::endsWith($count, $suffix) ? Str::beforeLast($count, $suffix) : $count;

$query->withCount($relation);
}
}

0 comments on commit b25d021

Please sign in to comment.