theProfit's avatar

Laravel Nova 4 to Laravel Nova 5

Hello everyone,

I recently upgraded from Laravel Nova 4 to Laravel Nova 5. Previously, I had a query that worked perfectly—it displayed the correct site in a dropdown. However, since the upgrade, while the dropdown still shows the correct options, I can no longer select a value.

After checking the documentation, I couldn’t find anything unusual or any clues about what might be causing this issue.

Any help would be greatly appreciated!

Select::make('Customer / Consignee Site', 'sites_id')
                ->searchable()
                ->hide()
                ->dependsOn(
                    ['customer'],
                    function (Select $field, NovaRequest $request, FormData $formData) {

                        if ($formData->customer) {
                            $customer = \App\Models\Customer::find($formData->customer);
                            $array = [];
                            foreach ($customer->sites as $site) {
                                $array[$site->id] = $site->address->zip_code . ' ' . $site->address->address . ' - ' . $site->name;
                            }
                            // $options = $supplier->sites->pluck('name', 'id')->toArray();

                            $field->options($array)->show();
                        } else {
                            $field->options([])->hide();
                        }

                    }

                )->hideFromDetail()->hideFromIndex()->required()
0 likes
0 replies

Please or to participate in this conversation.