Converts a query string into a nested where clauses for a QueryBuilder [Laravel]
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
demo
src
tests
.env.example
.gitignore
.travis.yml
LICENSE
README.md
composer.json
phpstan.neon
phpunit.xml

README.md

Laravel Eye

Build Status

Converts a query string into a nested where clauses for a Illuminate\DataBase\Query\Builder. This can be pretty usefull when building API.

Requirements

PHP 7.1 or later.

Usage


use Railken\LaraEye\Filter;
use Railken\SQ\Exceptions\QuerySyntaxException;
use App\Foo;


// Instance of Illuminate\DataBase\Query\Builder
$query = (new Foo())->newQuery()->getQuery();

$str_filter = "x > 5 or y < z";

$filter = new Filter("foo", ['id', 'x', 'y', 'z', 'created_at', 'updated_at']);

try {
    $filter->build($query, $str_filter);
} catch (QuerySyntaxException $e) {
    // handle syntax error
}

Syntax here

Composer

You can install it via Composer by typing the following command:

composer require railken/lara-eye

Demo

demo

License

Open-source software licensed under the MIT license.