Skip to content

ShowIf don't work with belongsTo in tabs #291

Description

@cocoweb94

When i call showIf on my tabs, the fields belongsTo are empty
Can you help me to fix that please ?

`
Tab::make('Identification professionnelle', [

                BelongsTo::make("Département d'inscription à l'ordre", 'identificationNumberState', AddressState::class)
                    ->hideFromIndex()
                    ->nullable()->withoutTrashed()->sortable(),

                Text::make('Adeli', 'adeli')
                    ->sortable()
                    ->rules('max:255')->onlyOnForms(),

                Text::make('Rpps', 'rpps')
                    ->sortable()
                    ->rules('max:255')->onlyOnForms(),

                Text::make('RPPS / ADELI')
                    ->exceptOnForms()
                    ->sortable()
                    ->displayUsing(function(){
                        return $this->getRppsAdeliInfosAttribute();
                    })
                    ->rules('required', 'max:255'),

                Text::make('Urssaf', 'urssaf')
                    ->sortable()
                    ->rules('required', 'max:255')->hideFromIndex(),

                Text::make('Ordinal', 'ordinal')
                    ->sortable()
                    ->rules('required', 'max:255')->hideFromIndex(),

                BelongsTo::make('Validé ?', 'identity', UserIdentity::class)
                    ->nullable()->withoutTrashed()->sortable(),

                ])->showIf(fn() => in_array($this->type_id, [self::ID_TYPE_CANDIDAT, self::ID_TYPE_INSTALLE])),`

ShowIf not activate
image (1)

ShowIf activate
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions