mkamel / searchable
v0.4.0
2022-12-02 18:44 UTC
Requires
- illuminate/support: ^9.0
Requires (Dev)
- phpunit/phpunit: ^8.5
This package is auto-updated.
Last update: 2026-03-29 00:42:51 UTC
README
1- Add this line to your app.php file in providers array:
MKamel\Searchable\SearchableServiceProvider::class,
2- Use Searchable Trait in your Model.
3- That will make Search function available for you model
User::search([ 'name' => 'alex', 'older_than' => 20 ]);
4- Create your Filters:
class ByOlderThanFilter { public function apply($query, $key, $value) { return $query ->where('age', '>=', $value) } }
5- You can update the filters directory by changing filters_namespace in config file.