Listing multiple values for a relationship with another attribute
I have a vehicle relation manager table where i want to display every IMEI numbers associated with the vehicle. On top of that, I want to format the imei list to include its' type as below.
Current code, obviously doesnt work:
Current code, obviously doesnt work:
11 Replies
Why doesn't it work? looks ok
this error appears
Property [type] does not exist on this collection instance.
I assume its because i didnt specify the array index..?no, it is saying DeviceImeis doesn't have type on that collection which is being returned
dd($record->DeviceImeis)
tried replacing with this, but every imei record will be same as the first record for ex "device"
Replace:
return $state . '(' . $record->DeviceImeis->type . ')';
with
dd($record->DeviceImeis);
return $state . '(' . $record->DeviceImeis?->type . ')';
I suspect some do not have a deviceImeis
hmm
output, 2021468386 is supposed to be Addon:
nope
sorry for late reply, just got to test it out, worked as u said. Thanks alot friend π