我试图对我的 JSON 响应进行分页,但出现这样的错误
调用未定义的方法 stdClass::count()
我使用 guzzle 来自 Laravel API 的 JSON 响应......
这是我的控制器代码
public function index()
{
$response = $this->client->get('getUserIndex')->getBody();
$content = json_decode($response->getContents());
$total = $content->count();
$paginationRecord = CollectionPaginate::paginate($content, $total, '15');
return view('configuration.comuserprofiles.ComUserProfilesList', ['paginationRecord' => $paginationRecord->data]);
}
Run Code Online (Sandbox Code Playgroud)