Is it possible to use another relationship if the current relationship is null?
As what the title says, I want to use an alternative relationship if the current is null:
if the company.name is null then i will use
if the company.name is null then i will use
company.external.nameSolution
You could use something like this.
``` ->getStateUsing(function($record){
Return $record->company->name ?? $record->external->name ?? Null;
})
Probably want to add additional checks, but you get the gist
``` ->getStateUsing(function($record){
Return $record->company->name ?? $record->external->name ?? Null;
})
Probably want to add additional checks, but you get the gist