ngaiza_287
ngaiza_287
FFilament
Created by ngaiza_287 on 1/23/2024 in #❓┊help
CheckboxList not passing data
Hello, i have search the docs but i cant seem to be able to selected items from the CheckBoxList. I have it nested in a wizard. All other fields data are coming through but i cant get data from the CheckboxList
Actions\Action::make('sendSms')
->label('Send message')
->steps([
Step::make('Contacts')
->description('Select the message recipients')
->schema([
CheckboxList::make('contactId')
->relationship('contacts', 'name')
->label('Contacts')
->bulkToggleable()
->searchable()
->columns(3)
->required(),
]),
Step::make('Message')
->description('Lets craft that message')
->schema([
Textarea::make('message')
->label('Message')
->minLength(2)
->autofocus()
->autosize()
->required(),
]),
])
->action(function (array $data): void {
dd($data['contactId']); // This is empty

foreach ($data['contactId'] as $id) {
//
}
})
Actions\Action::make('sendSms')
->label('Send message')
->steps([
Step::make('Contacts')
->description('Select the message recipients')
->schema([
CheckboxList::make('contactId')
->relationship('contacts', 'name')
->label('Contacts')
->bulkToggleable()
->searchable()
->columns(3)
->required(),
]),
Step::make('Message')
->description('Lets craft that message')
->schema([
Textarea::make('message')
->label('Message')
->minLength(2)
->autofocus()
->autosize()
->required(),
]),
])
->action(function (array $data): void {
dd($data['contactId']); // This is empty

foreach ($data['contactId'] as $id) {
//
}
})
1 replies
FFilament
Created by ngaiza_287 on 5/28/2023 in #❓┊help
repeater field test
please assist, am trying to check if a field in the repeater can through error if not available, and how i can use file in pest test to fill the field for testing. Here is a rough idea of what am trying to do. The class class Add extends Component implements HasForms { use InteractsWithForms; public $name = ''; public $phone_number = ''; protected function getFormSchema(): array { return [ TextInput::make('name') ->label('Full name') ->required(), Repeater::make('phones') ->relationship() ->schema([ TextInput::make('phone_number') ->label('Phone Number') ->hint('E.g: 255713001001 or 0713001001') ->required(), ]) ->label('Phone numbers') ->defaultItems(1) ->minItems(1) ->createItemButtonLabel('Add user phone number'), ]; } } The test livewire(Add::class) ->call('invite') ->assertHasErrors(['name', 'phone_number']);
4 replies
FFilament
Created by ngaiza_287 on 4/20/2023 in #❓┊help
Get Relationship Value in Table Action from Form
Hello, Am trying to get a value of a relationship field in table action from action form. I cant seem to get it of $data array. Action::make('add') ->label('Add Results') ->icon('heroicon-s-plus-circle') ->color('warning') ->form([ Select::make('exam_id') ->label('Examination') ->options(Exam::all()->pluck('name', 'id')) ->required(), Select::make('subject_id') ->label('Subject') ->relationship('subjects', 'name') ->hint('Please select only one subject') ->multiple() ->required() ->preload(), ])->action(function (Model $record, array $data): string { $subject = $data['subject_id']; // I need to get this value dd($subject); return redirect()->route('results.record', [ 'grade' => $record, 'exam' => $data['exam_id'], 'subject' => $data['subject_id'] ]); }),
5 replies