laravel validation unique if this field is changed

Solutions on MaxInterview for laravel validation unique if this field is changed by the best coders in the world

showing results for - "laravel validation unique if this field is changed"
Federica
06 Jul 2018
1use Illuminate\Validation\Rule;
2
3$request->validate([
4    'phone' => [
5        'required',
6        Rule::unique('table_name', 'column_name')->ignore($request->id),
7    ],
8]);