Skip to content

Commit

Permalink
[refs #1] Add new name feature to README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
anotherfrontendguy committed Jan 21, 2020
1 parent 0f42c32 commit 14e6779
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,16 @@ This package assumes you have a text-search setup for your Eloquent models. See
For this example let's assume a user belongs to a department and a department has many users.
To make the relationship searchable via a filter, add this to the `filters()` function of your Nova user resource:

By default the filter will display the name of the `fieldAttribute` you passed on instantiation. You can customize the name by passing it as an argument to the filter's construct function, for example `my-new-name`.

```php
// app/Nova/User.php
public function filters(Request $request)
{
return [
(new NovaSearchableBelongsToFilter)
(new NovaSearchableBelongsToFilter('my-new-name'))
->fieldAttribute('department')
->filterBy('department_id')
];
}
```
```

0 comments on commit 14e6779

Please sign in to comment.