Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

Termlaravel validation exists array data

//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 #data
ADD COMMENT
Topic
Name
4+9 =