orchidsoftware / platform

Orchid is a @laravel package that allows for rapid application development of back-office applications, admin/user panels, and dashboards.
https://orchid.software
MIT License
4.26k stars 631 forks source link

I use the "Select" field without setting the attribute "selected" #2767

Closed lihe6666 closed 6 months ago

lihe6666 commented 6 months ago

Describe the bug I get an error result when using the "Select" field.

To Reproduce Steps to reproduce the behavior:

Select::make('card.status')
      ->title('status')
      ->options(
          [
              0 => '资料审核中',
              1 => '正在组包中',
              2 => '处理完毕',
          ]
      )
      ->help(__('请选择要更改的状态')),

# This status value is 1.

Expected behavior I hope the second value will be added with the attribute "selected".

Screenshots If applicable, add screenshots to help explain your problem.

image

Desktop (please complete the following information):

Server (please complete the following information):

Additional context Add any other context about the problem here.

Help me!

lihe6666 commented 6 months ago

image

I'm trying to figure out if $value is a number to compare to $key, but I don't know if it makes sense, but in my project it works right now