Resource $recordTitleAttribute from relation
Hi, everyone! How can I set
$recordTitleAttribute
from relation:
Let's say, a WarehouseItem has many Products, and I can set $recordTitleAttribute = 'product_id'
, but I can't set it to 'product.name'
or 'product.sku'
, for example.
When I set protected static ?string $recordTitleAttribute = 'product'
it returns all product content in json format .Solution:Jump to solution
Solution founded: just needed to add
public static function getRecordTitle(?Model $record): string|null|Htmlable
{
return $record->product->name;
}
...1 Reply
Solution
Solution founded: just needed to add
public static function getRecordTitle(?Model $record): string|null|Htmlable
{
return $record->product->name;
}