I am new to laravel and working on apis, I have made an api in which i have implemented validation.Everything is working fine but i am stuck on a little thing. I want to to change the key name in the validation error. For example For the “unique” validation error. This is what now showing
I want to rename “email”(text) key with “message”(text)
I have tried so many thing in illuminate/support/validation.php
messagebag.php file but if it changes then error show of “data undefined”.
The links i followed are
This is the validation code
$validator = Validator::make($request->all(), [ 'first_name' => 'required', 'last_name' => 'required', 'email' => 'required|email|unique:users', 'fcm_token' => 'required', 'password' => 'required', 'c_password' => 'required|same:password' ]);