PHP code example of victormgomes / laravel-query-engine
1. Go to this page and download the library: Download victormgomes/laravel-query-engine 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/ */
victormgomes / laravel-query-engine example snippets
// app/Http/Requests/IndexUserRequest.php
use Illuminate\Foundation\Http\FormRequest;
use Victormgomes\LaravelQueryEngine\Attributes\MapQueryEngine;
use Victormgomes\LaravelQueryEngine\Traits\HasQueryEngineRules;
use App\Models\User;
#[MapQueryEngine(User::class)]
class IndexUserRequest extends FormRequest
{
use HasQueryEngineRules;
public function authorize(): bool
{
return true;
}
}
// app/Http/Controllers/UserController.php
use App\Models\User;
use App\Http\Requests\IndexUserRequest;
use Illuminate\Pagination\LengthAwarePaginator;
public function index(IndexUserRequest $request): LengthAwarePaginator
{
// Pass the request to automatically apply all URL parameters
return User::paginateQuery($request);
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.