sereny / nova-searchable-filter
Nova searchable filter for belongsTo relationships.
Installs: 11 076
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: ^8.0
- laravel/framework: >=9.0.0
- laravel/nova: >=4.0.0
This package is auto-updated.
Last update: 2024-11-11 20:17:46 UTC
README
Laravel Nova Searchable filter for belongsTo relationships.
Installation
composer require sereny/nova-searchable-filter
Usage
For this example let's assume a user belongs to a department.
To make the relationship searchable via a filter, add this to the filters()
function of your Nova user resource:
You need set first and second argument, which define the filter title and the relation name.
The final argument defines the attribute name to be used in the WHERE
condition.
// app/Nova/User.php use Sereny\NovaSearchableFilter\SearchableFilter /** * Get the filters available for the resource. * * @param \Laravel\Nova\Http\Requests\NovaRequest $request * @return array */ public function filters(Request $request) { return [ SearchableFilter::make(__('Departament'), 'department') ]; }