0
ページングを使用してデータベース内のすべてのデータを表示するインデックスページがあるとします。ユーザーが検索を実行した後に正しいデータとページ番号を表示できますが、2番目のページをクリックすると正しいデータが表示されません。ここでLaravel 5 1ページに複数のページ番号を使用する方法
public function getNewsletterSearch(Request $request) {
$keyword = $request->news_search;
$searchData = DB::table('tbl_contents')
->join('tbl_files', function ($join) use($keyword) {
$join->on('tbl_contents.unique', '=', 'tbl_files.unique')
->where('tbl_contents.record_type', '=', 'Newsletter')
->where('tbl_contents.title', 'LIKE', '%' . $keyword . '%')
->where('tbl_files.order_id', '=', 1);
})
->orderBy('tbl_contents.id', 'DESC')
->select('tbl_contents.*', 'tbl_files.file_name')
->paginate(6);
$searchData->setPageName('page_result');
return view('newsletter.index')->with(['searchData' => $searchData])->with('search', $keyword);
}
は図である。
<div class = "col-xs-12">
<nav aria-label = "Page navigation">
{{with(new App\Pagination\CustomPresenter($searchData->appends('page_result', Illuminate\Support\Facades\Input::get('page_result'))))->render()}}
</nav>
</div>
これは私が作成した検索機能です。検索結果から2ページ目に正しいデータを表示するソリューションは何ですか?