Display images from related search resources in Laravel Nova
P粉986937457
P粉986937457 2024-03-31 21:17:29
0
1
385

I create fields using relationships

BelongsTo::make

and want to add a search title image, the link to the image is stored as a url in the resource field

I tried making an img tag but the title escaped the html code

public function title()
{
    return "$this->name <img src='/open_emoji/lite_colored/$this->name.png'>";
}

https://nova.laravel.com/docs/4.0/resources/relationships.html#searchable-relations The documentation shows a picture to show that this is possible and that's it!

There is also a specific avatar field, but it's also poorly documented, and there's no explanation of how relationships are handled.

Can someone explain how to do this? I am using nova 4

P粉986937457
P粉986937457

reply all(1)
P粉936568533

So we need to use

in the sub-resource avatar field

Documentation: If a resource contains an avatar field, this field will appear next to the resource title when the resource appears in search results. https://nova.laravel.com/docs/4.0/ resources/fields.html#avatar-field

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template