Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

laravel validation unique if this field is changed

use IlluminateValidationRule;

$request->validate([
    'phone' => [
        'required',
        Rule::unique('table_name', 'column_name')->ignore($request->id),
    ],
]);
Source by laravel.com #
 
PREVIOUS NEXT
Tagged: #laravel #validation #unique #field #changed
ADD COMMENT
Topic
Name
2+3 =