Search

Uccello uses the library spatie/laravel-searchable to simplify the search for data.

You must configure the search for each model if you want :

  • Make it possible to search for data from the global search.

  • Make data search accessible from a list view for Entity fields.

Configuration

To activate the search in a module, please add the following code to the model related to this module:

<?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