I would like to use paginate. I researched if I use paginate() I have to erase ->get(). but I got error. Could you teach me how to add paginate please?
my current code
$images = ImageGallery::orderBy(DB::raw('LENGTH(wc), wc'))->get()->paginate(5);
return view('image-gallery2',compact('images'));
blade file code
UPDATE
if I do this
$images = ImageGallery::orderBy(DB::raw('LENGTH(wc), wc'))->get()->paginate(5);
This error
BadMethodCallException
Method Illuminate\Database\Eloquent\Collection::paginate does not exist.
If I write below
$images = ImageGallery::orderBy(DB::raw('LENGTH(wc), wc'))->paginate(5);
return view('image-gallery2',compact('images'));
I got this error
Facade\Ignition\Exceptions\ViewException
Call to undefined method App\ImageGallery::links() (View: //resources/views/image-gallery2.blade.php)
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2SavqWf
via IFTTT
Aucun commentaire:
Enregistrer un commentaire