是什么原因啊QAQ,我搜索的时候发现没人和我一样出错啊,laravel新手,求帮助QAQ
控制器代码:
public function lst()
{
$posts = Posts::paginate(2);
return view('posts/lst',compact('posts'));
}
lst.blade.php代码
<div>
@foreach($posts as $posts)
<div class="blog-post">
<h2 class="blog-post-title"><a href="/posts/{{$posts->id}}" >{{$posts->title}}</a></h2>
<p class="blog-post-meta">{{$posts->updated_at}} by <a href="/user/5">Kassandra Ankunding2</a></p>
<p>{{$posts->content}}
<p class="blog-post-meta">赞 0 | 评论 0</p>
</div>
@endforeach
</div><!-- /.blog-main -->
{{$posts->links()}}
Posts模型中没有找到links这个方法,检查一下看看是不是