You can probably do something like this:
use Illuminate\Validation\Rule;
...
->rules([
'required',
'array',
Rule::exists('regions', 'id'),
]);
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Forms\Components\CheckboxList::make('regions')
->label(__('Regions'))
->gridDirection('row')
->relationship(
titleAttribute: 'name',
modifyQueryUsing: fn (Builder $query) => $query->orderBy('id'),
)
->required()
// Here, how to validate each checkbox value that exists in regions table?
Normally in Laravel is doing something like this
public function rules(): array
{
return [
'regions' => 'required|array',
'regions.*' => 'distinct|exists:regions,id',
];
}
There is nothing about validate the checkbox value in the Filament Docs: https://filamentphp.com/docs/3.x/forms/fields/checkbox-list
You can probably do something like this:
use Illuminate\Validation\Rule;
...
->rules([
'required',
'array',
Rule::exists('regions', 'id'),
]);
Please or to participate in this conversation.