Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
ajcastro authored Aug 2, 2019
1 parent c275f31 commit 95f3005
Showing 1 changed file with 34 additions and 2 deletions.
36 changes: 34 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ $results = [

## Helper methods available on model

### isColumnValid
### isColumnValid [static]

- Identifies if the column is a valid column, either a regular table column or derived column.
- Useful for checking valid columns to avoid sql injection especially in `orderBy` query.
Expand All @@ -353,14 +353,46 @@ $results = [
Post::isColumnValid(request('sort_by'));
```

### getTableColumns
### getTableColumns [static]

- Get the table columns.

```php
Post::getTableColumns();
```

### enableSearchable

- Enable the searchable behavior.

```php
$query->getModel()->enableSearchable();
$query->search('foo');
```

### disableSearchable

- Disable the searchable behavior.
- Calling `search()` method will not perform a search.

```php
$query->getModel()->disableSearchable();
$query->search('foo');
```

### setSearchable

- Set or override the model's `$searchable` property.
- Useful for building searchable config on runtime.

```php
$query->getModel()->setSearchable([
'columns' => ['title', 'status'],
'joins' => [...],
]);
$query->search('foo');
```

## Warning

Calling `select()` after `search()` will overwrite `sort_index` field, so it is recommended to call `select()`
Expand Down

0 comments on commit 95f3005

Please sign in to comment.