FilamentF
Filament3y ago
zito

default value on form select not populating

I am attempting to have a value preselected when the Select item loads on a form. I only found two references to the default function in the docs, but no explanation on how to use it. I assume you pass an item that is in the options collection. Here is a snippet of what I tried:

$roles = Role::all()->pluck('name', 'id');
$defaultRole = $roles->first();

Select::make('role')
->options($roles)
->default($defaultRole)

Any reason why this isn't populating the default value?
Was this page helpful?