add custom attribute for validation errors laravel

Solutions on MaxInterview for add custom attribute for validation errors laravel by the best coders in the world

showing results for - "add custom attribute for validation errors laravel"
Fabiana
16 Jun 2019
1# add custom attribute for validation errors laravel 8
2$rules = [
3  'account_number' => ['required','digits:10','max:10','unique:bank_details']
4];
5$messages = [];
6$attributes = [
7    'account_number' => 'Mobile number',
8];
9$request->validate($rules,$messages,$attributes);
10// OR
11$validator = Validator::make($request->all(), $rules, $messages, $attributes);