I'm trying to use laravel validation to validate a form, but I'm not getting the array of errors
Controller
use Illuminate\Http\Request;
class Curriculos extends Controller {
public function store(Request $request){
$this->validate($request, [
'nome' => 'required|min:5'
]);
$curriculos = $request->all();
$curriculos['dt-nascimento'] = str_replace('/', '-', $curriculos['dt-nascimento']);
$curriculos['dt-nascimento'] = date('Y-m-d', strtotime($curriculos['dt-nascimento']));
$curriculos['dt-inicio'] = $this->formatDate($curriculos['dt-inicio']);
$curriculos['dt-conclusao'] = $this->formatDate($curriculos['dt-conclusao']);
$curriculo = new Curriculo;
if($curriculo->create($curriculos)){
return redirect('/');
}
}
View
<?php var_dump($errors->all()); ?>
<form class="" action="{{url('/api/send')}}" method="post">
@csrf
......
Var_dump () result
array(0) { }