0

I am building a Laravel Nova application and want to show a user with image and name.

 /**
 * The single value that should be used to represent the resource when being displayed.
 *
 * @var string
 */
public static $title = 'name';

As you can see above, the $title is used to represent the resource, but I want two values, a image (Avatar) and name (Sting).

Is this possible, or is it possible to show an other value like an image, instead of a string?

1 Answers1

0

Use Avatar field

If a resource contains an Avatar field, that field will be displayed next to the resource's title when the resource is displayed in search results

enter image description here

https://nova.laravel.com/docs/1.0/resources/fields.html#field-types

r00t
  • 468
  • 3
  • 10
  • This is correct, but not the answer to my question. I want to show change the way a resource is displayed in an index-page, for example within a other resource with a HasOne relationship. – Martin Bij de Vaate Oct 29 '18 at 08:51
  • Text::make('ImageName', function () { return ' '.$this->name })->asHtml() – r00t Oct 29 '18 at 14:22
  • This would be possible, but it is not the current resource. I use a `BelongsTo::make` to display a resource in a other resource. But I want the resource to be displayed always everywhere like Image-Name – Martin Bij de Vaate Oct 31 '18 at 15:21