Search
 
SCRIPT & CODE EXAMPLE
 

PHP

lengthawarepaginator gives keys on page 2

// On pages >= 2, the keys are returned since forPage returns an array with keys
// To fix this, just chain values() method.
$items_per_page = 10;
$current_page = LengthAwarePaginator::resolveCurrentPage();
$paginated_response = new LengthAwarePaginator(
  	collect($items)->forPage($current_page, $items_per_page)->values(),
  	count($items),
  	$items_per_page,
  	$current_page,
  	['path' => url('api/portfolios')]
);
return response()->json($paginated_response);
Comment

PREVIOUS NEXT
Code Example
Php :: how do i implement blockchain payments on laravel website 
Php :: Remove values from select list based on condition 
Php :: avoid data insertion if an error occurs in laravel 
Php :: laravel count 
Php :: Yii2 Dynamic Relational, Lazy loading 
Php :: wordpress microformats vs. schema.org 
Php :: cakephp Not Found error handle in pagination 
Php :: codeigniter 4 base_url 
Php :: date fomat in php 
Php :: tina4 create route 
Php :: FT_USER 
Php :: recaptcha v3 laravel 8 
Php :: search bar php progress 
Php :: wc php get shipping address street 
Php :: mod_fcgid: stderr: PHP Fatal error: Maximum execution time of 0 seconds exceeded in /home/circusconcepts/public_html/shop/system/library/PHPExcel/Shared/String.php on line 576 
Php :: File: C:xampphtdocsmarvellogistikapplicationlibrariesProfiler.php Line: 386 Function: sendDataInHeaders 
Php :: laravel tips 
Php :: laravel migration softdelete 
Php :: 12 months service expiary in php 
Php :: show real number and not exponential form php 
Php :: Round Number Up 
Php :: php decode base64 online 
Php :: BelongsToMany relations pivot fields are null in Livewire refresh 
Php :: ubuntu where are laravel logs stored 
Php :: laravel pagination prevent duplicate rows 
Php :: check if valid date format entered inside the excel import php 
Php :: how check word is in sentence php 
Php :: php base64 encode utf8 
Php :: he PHP exec() function must be enabled. 
Php :: install PHP extension "amqp" not found, please install it 
ADD CONTENT
Topic
Content
Source link
Name
7+2 =