From 25340558b9b24f25e9bbd1d37013866ec270e26b Mon Sep 17 00:00:00 2001 From: Alex Blake Date: Thu, 29 Mar 2018 11:07:27 +0200 Subject: [PATCH] added searchable parameter to models --- README.md | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7ea2a56..b5bdd97 100755 --- a/README.md +++ b/README.md @@ -43,9 +43,20 @@ return [ ``` -### Additional Feature: +## Usage -Implement the method 'isSearchable' in your models for the searcher to determine if it is allowed to search/return that model. +To make use of the search functionality, you will need to implement a `$searchable` property on your models to detail which fields and relations are searchable. +```php +/* +* Searchable Fields +*/ +public $searchable = [ + 'name', 'user_id', // fields + 'user', 'tags', // relations +]; +``` + +You can also implement the method 'isSearchable' in your models for the searcher to determine if it is allowed to search/return that model. ``` php public function isSearchable(){ // Do your checks to determine if the model may be searched by the user