错误:
调用未定义的方法Illuminate \ Database \ Query \ Builder :: appends()(查看:/var/www/resources/views/schools.blade.php)
刀片代码:
@if(!isset($_REQUEST['fees'])) {{
$result->appends([
'centers_of_excellence' => request('centers_of_excellence'),
'FeesRange' => request('FeesRange'),
'rankingsortby' => request('rankingsortby'),
'sortby' => request('sortby'),
'location' => request('location'),
'searchItem' => request('searchItem'),
'searchLocation' => request('searchLocation'),
'criteria' => request('criteria'),
'search' => request('search')
])->links()
}}
@endif
在控制器文件中:
public function paginate($items, $perPage = 15, $page = null, $options = [])
{
$page = $page ?: (Paginator::resolveCurrentPage() ?: 1);
$items = $items instanceof Collection ? $items : Collection::make($items);
return new LengthAwarePaginator($items->forPage($page, $perPage), $items->count(), $perPage, $page, [
'path' => Paginator::resolveCurrentPath()]);
}
不确定发生了什么。几周前它正在运作。我刚刚再次测试它,我收到了一个错误。
包含$ result变量的循环:
@foreach($result as $sch)
<div class="school-wrapper-content col-md-12">
<div class="school-left col-md-4">
<div class="school-name">
<div class="school-icon">
<img src="{{asset('images/'.$sch->logo)}}">
</div>
<div class="school-title">
<a href="{{$sch->url}}">{{strtoupper($sch->name)}}</a>
<br>
<span>{{$sch->location}}</span>
</div>
<div class="school-image">
<img src="{{asset('images/'.$sch->thumbnail)}}">
</div><br>
<div class="school-listing-action">
<a href="{{$sch->url}}">View Profile</a>
</div>
</div>
</div>
<div class="school-right col-md-8">
<strong>Board Exam Ranking (Metro Manila):</strong> @if($sch->ranking_metro_manila)
{{$sch->ranking_metro_manila}}
@else
<span>N/A</span>
@endif
<strong>Board Exam Ranking (Overall):</strong> @if($sch->ranking_philippines)
{{$sch->ranking_philippines}}
@else
<span>N/A</span>
@endif
<p>{{ str_limit($sch->describtion, 300) }};
</p>
<div class="score-card">
<div class="score-div">
<i class="fa fa-star-o" data-toggle="tooltip" data-placement="top" title="">
</i> <span class="score" style="font-size: 1em;"><strong>Term Structure:</strong><span style="color:orange;"> @if($sch->term_structure)
{{$sch->term_structure}} </span>
@else
<span>N/A</span>
@endif</span>
</div>
<div class="score-div">
<i class="fa fa-star-o" data-toggle="tooltip" data-placement="top" title="">
</i> <span class="score" style="font-size: 1em;"><strong>School Starts:</strong><span style="color:orange;"> @if($sch->school_year)
{{$sch->school_year}} </span>
@else
<span>N/A</span>
@endif</span>
</div>
<div class="score-div">
<i class="fa fa-money" data-toggle="tooltip" data-placement="top" title=""></i><span class="score" style="font-size: 1em;"><strong> Fees:</strong> <span style="color:orange;"> PHP {{$sch->fees}}</span></span>
</div>
<div class="score-div">
<i class="fa fa-star-o" data-toggle="tooltip" data-placement="top" title=""></i> <span class="score" style="font-size: 1em;"><strong>Entrance Exam:</strong> <span style="color:orange;"> @if($sch->entrance_exam)
{{$sch->entrance_exam}} </span>
@else
<span>N/A</span>
@endif</span>
</div><br><br>
<strong>Other Information</strong> <br><br>
<div class="score-div">
<i class="fa fa-star-o" data-toggle="tooltip" data-placement="top" title=""></i> <span class="score"><strong>Type:</strong> @if($sch->type)
{{$sch->type}}
@else
<span>N/A</span>
@endif</span>
</div>
<div class="score-div">
<i class="fa fa-star-o" data-toggle="tooltip" data-placement="top" title="">
</i> <span class="score"><strong>Religious Affiliation:</strong> @if($sch->religious_affiliation)
{{$sch->religious_affiliation}}
@else
<span>N/A</span>
@endif</span>
</div>
</div>
</div>
</div>
@endforeach