Call to a member function paginate() on null'[0]