how to convert laravel validation errors from object of array to array of key and value pairs

  api, laravel, lumen, php, validation

Please Help how to convert laravel validation errors from object of the array to array of key and value pairs

from { "name": [ "The name field is required." ], "password": [ "The password must be at least 9 characters." ] } to [ ‘name’=>’the name filed is required’, ‘password’=>’ the password field is required and must be at least 9 chars’, ]

Source: Ask PHP

LEAVE A COMMENT