Answers for "unique if change validation in laravel"

PHP
1

laravel validation unique if this field is changed

use Illuminate\Validation\Rule;

$request->validate([
    'phone' => [
        'required',
        Rule::unique('table_name', 'column_name')->ignore($request->id),
    ],
]);
Posted by: Guest on September-30-2021
1

laravel unique validation

unique:table,column,except,idColumn

############## Example : ################

############### For Updating  
//rules
'email' => 'unique:users,email_address,' . $userId,

############### For Creating 
//rules
'email' => 'unique:users,email_address',
Posted by: Guest on October-26-2020

Code answers related to "unique if change validation in laravel"

Browse Popular Code Answers by Language