我正在尝试加载分页数据,到目前为止能够加载整个记录。
现在不知道如何加载Laravel分页数据,因为当我发送没有分页的呼叫时,我会得到如下响应
{
'users':[{
'id':1,
'name':'Aamir'
},{
'id':2,
'name':'Jamshed'
}]
}但是,当我启用分页时,会有大量的数据与此相关,然后成员就会出现错误。
GET http://localhost:8000/api/users?citySef=Lahore&group=Ap
200 OK
87ms
vendor.js (line 9861)
WARNING: Encountered "total" in payload, but no model was found for model name "total"发布于 2015-05-14 12:15:02
这个必须固定在龙舌兰的末端,
$city = blood_cities::where('sef' , '=', [$citySef])->get();
$users = blood_users::where('city_id', '=',$city[0]->id)
->where( 'group', '=', $group )
->paginate(15);
$return = array(
'users' => $users->items(),
'meta'=> array(
'total'=>$users->total(),
'current_page'=>$users->currentPage(),
)
);
return $return;现在,成员将不会给错误,我们将得到结果。
更新: 2015-05-25
https://stackoverflow.com/questions/30055301
复制相似问题