怎么了?我对Laravel Paginator有一点小问题。
我使用order by和paginator构建了这个函数,但是我得到了错误消息"Call to undefined method Illuminate \ Database \ Query \ Builder ::links () (视图: C:\ wamp \ www \ laravel \ app \ views \ frontend \ premios.blade.php)。“
============= My Function ==============
public function premios()
{
$this->layout->content = View::make('frontend.premios')->with('premiostexto',PremiosTexto::all()) ->with('premios', Premios::orderBy('ordem', 'ASC')->paginate(5));
}==========My View============
@foreach($premios as $premios)
<span class="tituloPremio">{{$premios->titulo}}</span>
<span class="dataPremio">{{$premios->data}}</span>
@endforeach
{{ $premios->links() }}我尝试将"$premios->links()“放在foreach.Without分页的内外,一切正常
发布于 2014-08-12 00:16:24
您正在覆盖foreach中的$premios变量。在foreach中将其用作单数形式
@foreach($premios as $premio)
<span class="tituloPremio">{{$premio->titulo}}</span>
<span class="dataPremio">{{$premio->data}}</span>
@endforeach
{{ $premios->links() }}https://stackoverflow.com/questions/25247600
复制相似问题