ahmedash95's avatar

Pagination Query With Cache

Hello everybody

I'm trying to cache search results with Pagination but i always get error

this is my code

        $result = Cache::remember($stmt, 1440, function() use($title,$section,$state,$city) {
            $services =  Services::where('service_name', 'LIKE', '%' . $title . '%')
                ->where('service_city', 'LIKE', '%'.$city.'%')
                ->where('service_state', 'LIKE', '%'.$state.'%')
                ->where('service_section', 'LIKE', '%' . $section . '%')
                ->paginate(8);

            return $services;
        });

The result is :

                Serialization of 'Closure' is not allowed

how to fix it , please ? :)

0 likes
0 replies

Please or to participate in this conversation.