Skip to content

Commit

Permalink
added searchable parameter to models
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Blake committed Mar 29, 2018
1 parent 43e9035 commit 2534055
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2534055

Please sign in to comment.