In this example code:
public function test(Request $request) {
$rule = [
'name' => 'required'
];
$validator = Validator::make($request->all(), $rule);
if ($validator->fails()) {
return $validator->errors(); // <-- String format, not array
}
return $request->name;
}
I need that the error be a simple string.
Thanks
via Mer