这样的问题被问到,我搜索了很多,但没有发现任何对我有用的东西。
这是控制器功能:
public function showHomePage() {
$communities = Community::all();
$ideas = Idea::paginate(8);
return view('publicPages.index', compact(['communities', 'ideas']));
}
现在paginate method
正在运行,但在视野中我调用文档Docs中所述的方法
{!! $ idea-> render()!!}
它会产生以下错误
调用未定义的方法Illuminate \ Database \ Query \ Builder :: render()
我也试过{!! $idea->render() !!}
,但问题是一样的。试过这个$ideas = DB::table('ideas')->paginate(8);
以下是观点:
@foreach($ideas as $idea)
<div class="lst-popular-project clearfix">
<div class="grid_3">
<div class="project-short sml-thumb">
<div class="top-project-info">
<div class="content-info-short clearfix">
<a href="{{URL::to('showidea', array($idea->id))}}" class="thumb-img">
<img src="{{asset($idea->idea_image)}}" alt="$TITLE">
</a>
<div class="wrap-short-detail">
<h3 class="rs acticle-title">
<a class="be-fc-orange" href="project">
{{$idea->idea_title}}
</a>
</h3>
<p class="rs tiny-desc">
by
<a href="profile.html" class="fw-b fc-gray be-fc-orange">
{{$idea->User->name}}
</a>
</p>
<p class="rs title-description">
{{$idea->idea_info}}
</p>
<p class="rs project-location">
<i class="icon iLocation"></i>
{{$idea->idea_location}}
</p>
</div>
</div>
</div>
</div>
</div>
@endforeach
答案 0 :(得分:4)
你必须替换
{!! $idea->render() !!}
with
{!! $ideas->render() !!}
$ ideas变量包含from,total,page等
答案 1 :(得分:1)
我想它应该是$ideas
:
{!! $ideas->render() !!}