需求:页面上有两个甚至多个分页,Laravel如何解决?
解决方案:
Controller:
$hotted_questions = Question::orderBy('votes', 'desc')->paginate(5, ['*'], 'hotted_page'); $latest_questions = Question::orderBy('updated_at', 'asc')->paginate(5, ['*'], 'latest_page'); return view('frontend.qalist', compact('hotted_questions', 'latest_questions', 'current_active_item'));
View:
{{$latest_questions->appends(array_except(Request::query(), 'latest_page'))->links()}} {{$hotted_questions->appends(array_except(Request::query(), 'hotted_page'))->links()}}
文章的脚注信息由WordPress的wp-posturl插件自动生成