F
Filament10mo ago
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]);
}
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]);
}
1 Reply
jepewsykes
jepewsykes10mo ago
i not using getRecordUrl Function its working fine
Want results from more Discord servers?
Add your server