I’m getting the laravel stripe products. Issue I’m facing is that I don’t have pagination for the products I do research and get the pagination varibles for stripe API.
I try to implement but could get the desired result.here is my code
$limit = $request->length; </br>
$start = $request->start; </br>
$products = $this->stripe->products->all(['limit' => $limit,'starting_after' => $start > 0 ? $this->stripe->products->all(['limit' => $start + 1])->data[$start - 1]->id : null,'active' => true,])->data;</br>
if (isset($request->search_text)) {
$productName = $request->search_text;</br>
$products = collect($products)->filter(function ($product) use ($productName) {
return stripos($product->name, $productName) !== false;</br>
});
}
$totalProducts = $this->stripe->products->all(['active' => true])->data;</br>
$totalProductsCount = count($totalProducts);
New contributor
Daud Raza is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.