【发布时间】:2016-05-01 16:17:16
【问题描述】:
我使用这种方式为我的网站进行了分页,但仍然出现错误!我试图解决,我搜索了很多,没有找到解决方案。我希望你能帮助我。
控制器 -
class ContentController extends MasterController {
public function content() {
$content = content::all()->paginate(10);
$content->setPath('content'); //Customise Page Url
return view('content.boot',compact('content'));
}
}
查看 -
@extends('master')
@section('content')
@if(count($content) > 0 )
@foreach($content as $row)
<video width="330" controls>
<source src="{{ asset('videos/' . $row['video'] )}}" type="video/mp4">
</video>
@endforeach
@endif
{!! $content->render() !!}
@endsection
路线 -
Route::get('/', 'ContentController@content');
错误 -
Macroable.php 第 81 行中的 BadMethodCallException:
方法分页不存在。
【问题讨论】:
标签: php html laravel view pagination