This project demonstrates how to organize form checkboxes into groups with restrictions to choose values only from one group.
The main logic here lives between form()
method on our Resource and the create
and edit
functions
CreateTask
and EditTask
files to fit our new format and save relationships manuallyHere's how that looks in our form()
method:
return $form ->schema([ Forms\Components\TextInput::make('name') ->required() ->maxLength(255), Forms\Components\DatePicker::make('due_date'), // New section with checkboxes Forms\Components\Section::make('Assignees') ->schema([ // We are creating a new fieldset for Users Forms\Components\Fieldset::make('Users') ->extraAttributes(['class' => 'text-primary-600']) // We are creating 1 column for the fieldset ->columns(1) // We are setting the column span to 1 ->columnSpan(1) ->schema( // Here we dynamically generate checkboxes for each user by querying the database // ...