Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

zoonix's avatar
Level 12

resolveUsing not working with belongsto

We have a very simple format to show a field in upper case.

            BelongsTo::make('State')
                ->resolveUsing(function ($name) {
                    return strtoupper($name);
                }),

Works fine on a Text::make field, but not BelongsTo::make. Checked all the usual places, but can't find any reference to it. Is there a different way to accomplish this or should resolveUsing or displayUsing work there?

0 likes
1 reply
zoonix's avatar
Level 12

Figured it out, ust had to change resolveUsing to displayUsing and specify the column in the return

            BelongsTo::make('State')
                ->displayUsing(function ($state) {
                    return strtoupper($state->abbreviation);
                }),

Please or to participate in this conversation.