REST API in Laravel when validating the request

these code will help you, working for me.

$response = array('response' => '', 'success'=>false);
$validator = Validator::make($request->all(), $rules);

if ($validator->fails()) {
  $response['response'] = $validator->messages();
} else {
//process the request
}

return $response;

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)