1
I’m trying to use the validation of the Laravel 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
......
Result of Var_dump()
array(0) { }
Where is this route set in web.php or api.php
– Jorge Costa
In api, as Post
– Luhan Salimena