FilamentF
Filament3y ago
Vp

cache with table query

I want to create cache for table builder, but the ->query() expect query builder, not eloquent, how can I create cache
public function table(Table $table): Table
{
    return $table
        ->query(
            // not working
            // Cache::remember('users', 60 * 60 * 24, function () {
            //    return User::query();
            // })
            User::query() // working
        );
}

User::get() inside cache is working, but table expect query..
Solution
I don't think you can

till eloquent call the get() it won't execute the query and then nothing to cache
Was this page helpful?