Skip to content

Instantly share code, notes, and snippets.

@rdgutierrez
Last active August 29, 2015 14:19
Show Gist options
  • Select an option

  • Save rdgutierrez/418173f9f3300077471f to your computer and use it in GitHub Desktop.

Select an option

Save rdgutierrez/418173f9f3300077471f to your computer and use it in GitHub Desktop.
Error "FatalErrorException: Error: Call to undefined method Illuminate\Database\Eloquent\Collection::paginate()"
Según lo que dice este post https://github.com/laravel/framework/issues/213
Si estas obteniendo el siguiente error
FatalErrorException: Error: Call to undefined method
Illuminate\Database\Eloquent\Collection::paginate()
El error se da por querer usar ::all()->paginate(15); la idea es usar por ejemplo si estamos leyendo la tabla users:
User::paginate(15);
Lo que si es aceptable es meter condiciones a la busqueda, como esto:
Post::where('user_id', '=', $id )->paginate(5);
Esto también es aceptable
Items::orderBy('day', 'ASC')->orderBy('level', 'ASC')->paginate(10);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment