Search
 
SCRIPT & CODE EXAMPLE
 

PHP

laravel api pagination automatically get request

$users = User::paginate($request->get('perPage')); 
$users->appends($request->all());
Comment

pagination in api laravel

follow this link 
https://github.com/spatie/laravel-json-api-paginate
Comment

Paginating API HTTP Response in Laravel

 public function paginate ($items, $perPage =4,  $page = null) {
        $page = $page ?: (LengthAwarePaginator::resolveCurrentPage() ?:1);
            $total = count($items);
            $currentpage =$page;
            $offset = ($currentpage * $perPage) - $perPage;
            $itemstoshow =array_slice($items, $offset, $perPage);
        return new LengthAwarePaginator($itemstoshow, $total, $perPage);
    }

public function fetch() {
//connect to api
$collection= Http::get('192.168.1.19/EnwealthWebAPi/ke/enwealth/contributions?memberNo=KEMI-002&company=KEMI%20SRBS')->json();     
// return view('test', ['collection' =>$collection['value']]);
return view('test', ['collection' =>$collection['value']]-paginate(20));
}

Comment

PREVIOUS NEXT
Code Example
Php :: remove exact characters from string using php 
Php :: laravel http response with cookie 
Php :: laravel validation alphanumeric with spaces 
Php :: add password php file 
Php :: can you call a javascript cookie using php 
Php :: calculate 1 day interest 
Php :: str_word_count() 
Php :: authenticate user with phone laravel 
Php :: php time passed since date 
Php :: generate parentheses 
Java :: vm options javafx 
Java :: androidx recyclerview dependency 
Java :: spigot broadcast message 
Java :: how to play sounds on java 
Java :: java read file to string 
Java :: how to check if a string contains only alphabets and numbers in java 
Java :: open link in android studio 
Java :: how to circular a bitmap android 
Java :: java for loop high to low 
Java :: dialog getWindow().setBackgroundDrawable transparent 
Java :: how to install java 8 on aws linux 
Java :: array to map java10 
Java :: java close jframe 
Java :: hibernate dependency 
Java :: java jcombobox itemlistener only if value changed 
Java :: java string join arraylist 
Java :: java deltaTime 
Java :: android studio linearlayout set margin 
Java :: add days to date java 
Java :: check if char is in char array java 
ADD CONTENT
Topic
Content
Source link
Name
5+2 =