I'm having some trouble implementing pagination in Laravel 5. Though probably not what you would think. I can get everything to work but can't understand how to get it to pull the correct information on the second page. Here is what I have:
Routes:
Route::resource('find-a-wp-theme', 'searchController');
Controller:
public function store(){
$themes['themes'] = Fulls::where("tags", "like", "%".$_POST['theme']."%")->orwhere("tags", "like", "%".$_POST['free']."%")->orwhere("title", "like", "%".$_POST['free']."%")->paginate(12);
return view('find-a-wp-theme', $themes);
}
View:
@if($themes)
@foreach($themes as $theme)
{{$theme['title']}}<br />
<img style="width:250px;" src="{{$theme['image']}}"><br />
@endforeach
{!! $themes->render() !!}
@endif
Up till here everything works just fine. My problem is that when I click the paginating button it takes me to mypage?page=2 which actually takes me to the resource index()
and I can't understand how to implement this correctly.
Any help would be much appreciated!