1. Go to this page and download the library: Download klips/dingoquerymapper library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
public function getAllUsers(Request $request) {
$users = User::all()->get();
$qm = new DingoQueryMapper($request);
$users = $qm->createFromCollection($users)->paginate();
// now return the result
return response->json($users);
}
/index?name=j*&age>=18&limit=10&page=3
public function getAllUsers(Request $request) {
$users = User::all()->get();
$qm = new DingoQueryMapper($request);
$users = $qm->createFromCollection($users)->paginate();
// now return the result
return $this->response
->paginator($users, new UserTransformer());
}