© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
1 reply
Albert Lens

$record->relationship->fieldData not working

I have a resource for persona (People in Spanish) and I am showing a column which comes from a relationship and it is working correctly.

TextColumn::make('interviniente.tipoExpediente')
                    ->label('TipoExp')
TextColumn::make('interviniente.tipoExpediente')
                    ->label('TipoExp')


Now I need to make an action which will redirect to a different URL depending on the value in that columns TipoExp.

I have tried this:
->url(function (Persona $record){

      switch ($record->tipoExp)
      {
          case 'Herencia':
              return 'expedientes-herencia/' . $record->id;
              break;
          case 'Compra-Venta':
...
->url(function (Persona $record){

      switch ($record->tipoExp)
      {
          case 'Herencia':
              return 'expedientes-herencia/' . $record->id;
              break;
          case 'Compra-Venta':
...


But it is returning nothing. It looks as if $record->tipoExp has nothing inside.
I have also tried to access through the related relationship, but it is not working either:

switch ($record->interviniente->tipoExpediente)
switch ($record->interviniente->tipoExpediente)


Not working either.

How could I solve this, please??
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Relationship repeater not working
FilamentFFilament / ❓┊help
2y ago
TextColumn get relationship record
FilamentFFilament / ❓┊help
2y ago
afterFill hook not working for relationship data while creating the record
FilamentFFilament / ❓┊help
2y ago
Restore not working on Relationship
FilamentFFilament / ❓┊help
2y ago