laravel validation unique if this field is changed

88

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),
    ],
]);

Comments

Submit
0 Comments