dinkbit / filterable
Make your eloquent models filterable with ease.
Installs: 34
Dependents: 0
Suggesters: 0
Security: 0
Stars: 6
Watchers: 8
Forks: 0
Open Issues: 0
pkg:composer/dinkbit/filterable
Requires
- php: >=5.4.0
- illuminate/support: ~4.0|~5.0
Requires (Dev)
- mockery/mockery: ~0.9
- phpunit/phpunit: ~4.0
This package is not auto-updated.
Last update: 2025-09-27 22:28:01 UTC
README
Setup
use Dinkbit\Filterable\FiterableTrait; class Post extends Eloquent { use FilterableTrait; /** * Enabled filterable scopes. * * @var string */ protected $filterable = ['price', 'quantity']; public function scopePrice($query, $param) { return $query->where('price', $param); } public function scopeQuantity($query, $param) { return $query->where('item_quantity', $param); } }
Usage
$posts = Post::filter(['quantity' => 10, 'price' => '100'])->get();