staudenmeir / eloquent-has-many-deep

Laravel Eloquent HasManyThrough relationships with unlimited levels

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

distinct - paginate

fit-vanson opened this issue · comments

Please help me check why the returned result is not the same as the result when using ->total() in paginate()

// model Domains:
image
//model Tags
image

//controller:
image
//result
image

Hi @fit-vanson,
Unfortunately, this topic is quite complex (and annoying). Please remove ->distinct() and try this instead:

$query = $domain->wallpapers($isBlock)
    ->where(...)
    ->getQuery()
    ->select('wallpapers.*')
    ->groupBy('wallpapers.id')
    ->paginate(...);