For do infinite scroll with paginate in l5 i found a lot of articles but they all use this paginate() function as they use result set from db but i'm fetching the data from googlefontapi as json so when i use paginate() in json it cause an error and also in array. my code
public function index(){
$url = "https://www.googleapis.com/webfonts/v1/webfonts?key=!";
$result = json_decode(file_get_contents( $url ))->paginate(10);
$font_list = "";
foreach ( $result->items as $font )
{
$font_list[] = [
'font_name' => $font->family,
'category' => $font->category,
'variants' => implode(', ', $font->variants),
// subsets
// version
// files
];
}
return view('website_settings')->with('data', $font_list);
}
and the error is
Call to undefined method stdClass::paginate()
is there any other way to achieve it