Posts Learn Components Snippets Categories Tags Tools About
/

Make Laravel Nova Relation Searchable

Learn how to make Laravel Nova relation searchable to easily search for records

Created on Aug 16, 2021

745 views

To make the relationship searchable, you can chain the "searchable()" method onto the filed definition. 
BelongsTo::make('User')->searchable()
If you want to conditionally check if a field should be searchable, you can pass a closure to the searchable method.
BelongsTo::make('User')->searchable(function ($request) {
    return true;
})
Once you have defined that, you will be able to search the relation like below.
Search Relation

If you like our tutorial, do make sure to support us by being our Patreon or buy us some coffee ☕️

Load comments for Make Laravel Nova Relation Searchable

)