Open backstageel opened 5 years ago
@backstageel Thanks for submitting your issue. This package will not work with third-party query builders, only with Laravel's query builder. Sorry.
Actually, i got this Working...
It was as simple as creating a custom builder class that extends Spatie's QueryBuilder and apply the traits from this package on it:
namespace App\Builders;
use GeneaLabs\LaravelModelCaching\Traits\Buildable;
use GeneaLabs\LaravelModelCaching\Traits\BuilderCaching;
use GeneaLabs\LaravelModelCaching\Traits\Caching;
use Spatie\QueryBuilder\QueryBuilder;
class CustomBuilder extends QueryBuilder
{
use Buildable;
use BuilderCaching;
use Caching;
}
I'll add this to the documentation, thanks!
@mikebronner This doesn't seem to be added to the documentation? :)
@backstageel Does it still work for you?
I think I removed it again, because I started work on developing an internal solution that wouldn't require more work. Unfortunately I have not been able to complete that at this time due to life circumstances changing A LOT this year.
"a custom builder class" not work for me
"message": "Property [localMacros] does not exist on the Eloquent builder instance.", "exception": "Exception"
any update?
Describe the bug Seems Like this Package doesn't work when using Spatie's Laravel query builder to fetch the data (https://github.com/spatie/laravel-query-builder). I've checked that package and they don't override newEloquentBuilder() method, so all should work.
By not working i mean no cache data is returned and the query still hits the database.
Eloquent Query This query don't work
But this work:
Stack Trace No stack trace, because no error is generated. Just no data is cached
Environment