Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/vim/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Pagination 调用未定义的方法Illumb\Database\Eloquent\Collection::appends()_Pagination_Group By_Laravel 5 - Fatal编程技术网

Pagination 调用未定义的方法Illumb\Database\Eloquent\Collection::appends()

Pagination 调用未定义的方法Illumb\Database\Eloquent\Collection::appends(),pagination,group-by,laravel-5,Pagination,Group By,Laravel 5,我的问题是调用未定义的方法illumb\Database\elount\Collection::appends() 我的问题是: $companies=\App\Payment::where('company_id',$id)->paginate(10)->groupBy('month')->groupBy('job_id'); 分页错误 {!! $companies->appends(['sort' => 'created_at'])->render()

我的问题是调用未定义的方法illumb\Database\elount\Collection::appends()

我的问题是:

$companies=\App\Payment::where('company_id',$id)->paginate(10)->groupBy('month')->groupBy('job_id');
分页错误

{!! $companies->appends(['sort' => 'created_at'])->render() !!}  

这是因为您得到的是一个集合对象而不是paginator对象

调用
groupBy
并将其分配给
$companys
变量时,您有一个集合对象,它没有
appends
方法

而是将paginator分配给companys变量,然后将其分组

$companies=\App\Payment::where('company_id',$id)->paginate(10);