FilamentF
Filament2y ago
2 replies
core

globalsearch - custom query - returns result but no URL to edit page

i have tweaked the getGlobalSearchResults, i get the results but it not clickable
    protected static ?string $recordTitleAttribute = 'translations.title'; 
public static function getGlobalSearchResults(string $search): Collection
    {
        return static::getModel()::query()
            ->whereHas('translations', function ($query) use ($search) {
                $query->where('title', 'like', '%'.$search.'%');
            })
            ->get();

    }

    public static function getRecordUrl(Model $record): ?string
    {
        return static::getUrl('edit', ['record' => $record]);
    }
Was this page helpful?