Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

Termlaravel validation exists array rules

//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',
    ];
}
 
PREVIOUS NEXT
Tagged: #Termlaravel #validation #exists #array #rules
ADD COMMENT
Topic
Name
6+1 =