//Be careful it does multiple queries.
//'document_group_ids.*' => 'exists:document_groups,id'
public function rules(): array
{
return [
'document_type_id' => 'required|integer|exists:document_types,id',
'document_group_ids' => 'required|array',
'document_group_ids.*' => 'exists:document_groups,id',
];
}