getRecordTitleAttribute from related model
Dear all, last time I have a lot of question. Please how can I create record title attibute from realated mode? for getGloballySearchableAttributes it works fine, but for getRecordTitleAttribute; in the Filament docs I read that it's must be a column / attributefrom model ... but is possible to get from related model ?
Solution:Jump to solution
This would go on your edit and view page classes. Not on the resource.
```php
use Illuminate\Contracts\Support\Htmlable;...
11 Replies
Have you tried
Or something from the docs here: https://filamentphp.com/docs/3.x/panels/resources/global-search#adding-extra-details-to-global-search-results
Thanks for answer, function getGlobalSearchResultTitle works fine, but i want by this way set the getRecordTitleAttribute ... i try:
btw thanks for your YTB chanel 👍
any errors?
nothing happend.
Undefined variable $record
try
$this->record
error => Using $this when not in object context
don't use this method
this method only gets the $recordTitleAttribute property
what's wrong with the getGlobalSearchResultTitle?
Are you trying to display the table column differently? What exactly are you trying to change on the page?
want to replace "Driver card" with fullName of user who is related to to driver card, tha sme in the infolist / edipage for driver card. I do it for Vehicles, but in this case i use where vehicleName is column id db / model attribute. So... is possible pass relation 'user.fullName' to tittle attribute ? If no, probably i will create collumn in driver card with user fullname and immediately update it of user change name ...
Solution
This would go on your edit and view page classes. Not on the resource.
Thanks !