Skip to content
This repository was archived by the owner on Mar 22, 2020. It is now read-only.

Latest commit

 

History

100 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel Queryable

tests styleci scrutinzer downloads release license

Laravel Queryable is a light weight package containing simple injectable model traits with configurable attributes to perform powerful and flexible queries of your models dynamically from static HTTP routes.

Made with ❤️ by Stephen Lake

No Longer Maintained ❗

This package is no longer maintained as a far more flexible package exists, it is highly recommended to use Spatie's Laravel Query Builder instead. If you would like to take over this package as maintainer, please get in touch with me.

Getting Started

Install the package via composer.

composer require stephenlake/laravel-queryable

Add the trait to your model:

use \Queryable\Traits\QueryParamFilterable;

Define filters on your model:

YourModel::withFilters(['name', 'content', 'created_at'])->get();

Then add dynamic queryables to your HTTP routes:

https://www.example.org?name=Awesome&content=*awesome*&created_at>=2018

This automatically adds the following to the query builder:

YourModel::where('name', 'Awesome')
         ->where('content', 'like', '%awesome%')
         ->where('created_at, '>=', '2018')

See documentation for the full list of available operators and further usage.

License

This library is licensed under the MIT License - see the LICENSE.md file for details.

About

Filter models by their attributes and/or relations via HTTP URI query params.

Resources

Stars

47 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages