mkamel / searchable
Installs: 12 687
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 1
Open Issues: 0
Requires
- illuminate/support: ^9.0
Requires (Dev)
- phpunit/phpunit: ^8.5
This package is auto-updated.
Last update: 2025-05-29 01:22:52 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.