我正在尝试将分页添加到我的评论框中,但是当我添加时
{!! $statuses->rendor() !!}
我得到这个错误:
我Macroable 中的 ErrorException.php第 81 行: 方法生成器不存在。(查看:/home/vagrant/sites/social/resources/views/timeline/index.blade.php)
在网上搜索了一下,我看到有几个人有这个问题,但没有答案。 据我了解,这是因为 laravel 无法找到保存此方法的文件。如果有人能阐明这个问题的解决方案,我将不胜感激。提前谢谢。我已经添加了我的索引刀片.php:
@extends('templates.default')
@section('content')
<div class="row">
<div class="col-lg-6">
<form role="form" action="{{ route('status.post') }}" method="post">
<div class="form-group{{ $errors->has('status') ? ' has-error' : ''}}">
<textarea placeholder="What's up {{ Auth::user()->getFirstNameOrUsername() }}?" name="status" class="form-control" rows="2"></textarea>
@if($errors->has('status'))
<span class="help-block">{{ $errors->first('status') }}</span>
@endif
</div>
<button type="submit" class="btn btn-default">Update status</button>
{{ csrf_field() }}
</form>
<hr>
</div>
</div>
<div class="row">
<div class="col-lg-5">
<!-- Timeline statuses and replies -->
@if(!$statuses->count())
<p>Theres nothing in your timeline yet.</p>
@else
@foreach($statuses as $status)
<div class="media">
<a class="pull-left" href="{{ route('profile.index', [
'username' => $status->user->username
]) }}">
<img class="media-object" alt="{{ $status->user->getNameOrUsername() }}" src="{{ $status->user->getAvatarUrl() }}">
</a>
<div class="media-body">
<h4 class="media-heading"><a href="{{ route('profile.index', [
'username' => $status->user->username
]) }}">{{ $status->user->getNameOrUsername() }}</a></h4>
<p>{{ $status->body }}</p>
<ul class="list-inline">
<li>{{ $status->created_at->diffForHumans() }}</li> <!-- The diffForHumans() function will change the time to like 1 hour ago etc. -->
<li><a href="#">Like</a></li>
<li>10 likes</li>
</ul>
<form role="form" action="#" method="post">
<div class="form-group">
<textarea name="reply-1" class="form-control" rows="2" placeholder="Reply to this status"></textarea>
</div>
<input type="submit" value="Reply" class="btn btn-default btn-sm">
</form>
</div>
</div>
@endforeach
{!! $statuses->rendor() !!}
@endif
</div>
</div>
@stop
它
应该是一个->render()
的方法。
https://laravel.com/docs/5.1/pagination#displaying-results-in-a-view
而不是
{!! $statuses->rendor() !!}
使用这个
{!! $statuses->render() !!}