laravel validation unique if this field is changed

93

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