Search
Configuration
<?php
namespace App;
use Spatie\Searchable\Searchable;
use Spatie\Searchable\SearchResult;
use Illuminate\Database\Eloquent\Model;
class Person extends Model implements Searchable
{
...
public $searchableType = 'domain'; // An unique key. Put here the domain's name.
public $searchableColumns = [
'name' // Replace by the attributes of the model in which you want to activate the search.
];
public function getSearchResult(): SearchResult
{
return new SearchResult(
$this,
$this->recordLabel // The record label you want to display for the search results.
);
}
...
}Last updated
Was this helpful?