vinschi's avatar
Level 16

Problem with Service Provider and pagination

Hi guys, I defined the booth() method in my AppServiceProvider in this way:

public function boot()
    {
        \View::composer('*', function ($view) {
            $movies = \Cache::remember('movies', 1, function () {
                return Movie::all();
            });
            $view->with('movies', $movies);
        });
    }

so that I have all the movies in each view however I have a problem, before I was passing to my movies.index view all the movies from the movie controller and then I was paginating them with the links() method, now that I'm using the AppServiceProvider I have an error for the links() and I can't paginate the movies. I tried to use the paginate() method in the AppServiceProvider but doesn't change anything. Any ideas? Thanks

0 likes
1 reply

Please or to participate in this conversation.