0
我有下面的代码显示从数据库分页中laravel显示笨拙
<h2> Unsolved Questions </h2>
@if(!$questions)
<p> There are no Unsolved Questions </p>
@else
<ul>
@foreach($questions as $question)
<li> {{ $question->questions }}</li>
@endforeach
</ul>
{{ $questions->links() }}
@endif
结果显示正常未解决的问题但是分页结果表明这样的
«
1
2
»
哪里能问题是?
控制器
public function create()
{
return View::make('questions.create')
->with('title', 'Q&A ask/Answer question')
->with('questions', Question::unsolved());
}
型号
public static function unsolved()
{
return static::where('solved', '=', 0)->orderBy('id', 'DESC')->paginate(5);
}