liqrgv / query-filter-laravel
Query filter shortcut for controller
Installs: 1 916
Dependents: 0
Suggesters: 0
Security: 0
Stars: 9
Watchers: 3
Forks: 2
Open Issues: 1
Type:project
Requires
- haydenpierce/class-finder: ^0.4.0
Requires (Dev)
- fzaninotto/faker: >=1.4
- illuminate/routing: >=6.0
- laravel/lumen-framework: >=6.0
- mockery/mockery: >=1.0
- phpunit/phpunit: >=7.0
README
Change your Request into Query builder
With this package, we can prevent doing tedious work of composing query builder This package will turn URL query
book?filter[title][is]=Harry&filter[published_at][>]=2010-10-13
into
Book::query()
->where('title', '=', 'Harry')
->where('published_at', '>', '2010-10-13')
Getting Started
You can install this package via composer CLI using
composer require liqrgv/query-filter-laravel
Usage
You can add RequestParser
class to your route closure
Route::get('/model', function(RequestParser $parser) {
$builder = $parser->getBuilder();
// do something with builder
.............
});
or on your controller
public function index(RequestParser $parser) {
$builder = $parser->getBuilder();
// do something with builder
.............
}
Running the tests
In order to running the test, you should have composer
on your system.
Read more on https://getcomposer.org/doc/00-intro.md
You should install dependency for testing with
composer install
After that, you can run all test with
./phpunit
Deployment
(TBD)
Contributing
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
Versioning
We use SemVer for versioning. For the versions available, see the tags on this repository.
Authors
- Septian Hari - Initial work - LIQRGV
See also the list of contributors who participated in this project.
License
This project is licensed under the Apache License
Acknowledgments
- Hat tip to anyone whose code was used
- Inspiration
- etc