5

I need to show a selected role of User in the Select Fields is there any method in which I can pass the value and it would be selected by default with the show Labels.

1 Answers1

12

The problem is completely solved, the solution is:

Select::make('My type', 'type')
    ->options(\App\Models\Cost::TYPE)
    ->sortable()
    ->resolveUsing(function () {
        return $this->type ?? 'expense';
    })
    ->displayUsingLabels()
    ->rules('required'),