TextColumn get relationship record
Is it possible to get the $record of the relationship of a resource when creating a TextColumn like this:
This was added to my ProductResource, where the above log output gives the product record. Is it somehow possible to get the sku record that the price belongs to instead?
Solution:Jump to solution
no, there is not currently a way to do that, but you could guess which sku it is based on the price
4 Replies
$record->skus
Thanks, but I was more thinking of getting each individual sku record. Because when there is a has many relationship, the price for all of the resources sku records will be rendered. Here I would want to for example add an icon for each sku record, which would depend on $sku->attributeValues
Solution
no, there is not currently a way to do that, but you could guess which sku it is based on the price
Thanks @Dan Harrin ! It lead me in the right direction, where I can get the sku record in my case with
$record->skus->firstWhere('price', $state)
.