PHP code example of klips / dingoquerymapper

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/ */

    

klips / dingoquerymapper example snippets


php artisan vendor:publish --provider="JohannesSchobel\DingoQueryMapper\DingoQueryMapperServiceProvider" --tag="config"

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());
}

/index?limit=20

/index?limit=20&page=2

/index?sort=age,-name

/index?name=j*&age>=18&sort=age,-name&limit=20
 php
'providers' => [
   ... ,
   JohannesSchobel\DingoQueryMapper\DingoQueryMapperServiceProvider::class,
],