Search
 
SCRIPT & CODE EXAMPLE
 

PHP

laravel validation array unique values

<?php
$validator = Validator::make($request->all(), [
  'myArray' => ['required', 'array', 'min:1', 'max:100', 'distinct'],
  'myArray.*' => ['required', 'integer', 'min:1', 'max:999999']
]);

if ($validator->fails()) {
  return [
    'status' => 400,
    'response' => $validator->errors()
  ];
}

$validated = $validator->validated();

// distinct is there for the uniqunes
Comment

laravel validate form data unique array

'username' => ['required', Rule::unique('users', 'username')],
Comment

PREVIOUS NEXT
Code Example
Php :: share with all blade in laravel 
Php :: exceptions on fatals(2) 
Php :: phpmailer 5 string attachment 
Php :: how to make:trait in commend line in laravel 
Php :: array issue in php 
Php :: wp wc php change customer shipping country for all users 
Php :: mac php.ini catalina 
Php :: Obtener rol de usuario registrado en WordPress 
Php :: Deactivate click events on product card image, title and contents 
Php :: publish algolia search in laravel 
Php :: Detecting specifically the My account "Dashboard" page 
Php :: firebase php curl 
Php :: laravel list get x amount in a collection 
Php :: Removing the additional information tab using PHP code snippet 
Php :: wordpress ftp functions.php 
Php :: CausesActivity trait 
Php :: function placing bet in guide using php 
Php :: Fehler beim Uploadtest der ausgewählten Datei. 
Php :: br2nl 
Php :: concatenar 
Php :: php expire session for 1 month 
Php :: php slim inspect request method 
Php :: menggunakan pengkondisian dalam string php 
Php :: veue laravel remove #/ 
Php :: wc php free shipping function 
Php :: php get current datetime in us chicago 
Php :: envoyer mail php depuis localhost 
Php :: Collapse all codes in PHP Storm IntelliJ 
Php :: laravel yajra datatable Add Column with View 
Php :: Argument 1 passed to DoctrineInflectorInflector::singularize() must be of the type string, null given, 
ADD CONTENT
Topic
Content
Source link
Name
4+8 =