justbetter / laravel-pagination-with-havings

Makes it possible to use pagination with havings in queries with Laravel.
MIT License
66 stars 10 forks source link

newBaseQueryBuilder Error #5

Closed naumanahmed19 closed 4 years ago

naumanahmed19 commented 4 years ago

Hi,

Thanks for this awesome package. It works great however there is a conflict with another package that I am using. https://github.com/jarektkaczyk/eloquence

When I add trait I get the following error.

Trait method newBaseQueryBuilder has not been applied, because there are collisions with other trait methods

The following method fixes the problem but in that case, I cant use Sofa/Eloquence

    use PaginationWithHavings,Eloquence{
        PaginationWithHavings::newBaseQueryBuilder insteadof Eloquence;
    }

Any idea how to fix it?

royduin commented 4 years ago

You've to merge the functionality together on your own. Create your own builder class based on the builder from Eloquence (just extend that class) and overwrite the runPaginationCountQuery() method and merge the functionality together. After that overwrite the newBaseQueryBuilder() in the models and use your own Query Builder class. Or create a trait you can use.