I have a problem to do validation in the update in Laravel.
My Controller looks like this:
public function editar(EspecieRequest $request, Especie $esp)
{
$especie = Especie::find($esp->id_especie);
$valores = Request::all();
$especie->fill($valores)->save();
return redirect()->action('EspecieController@lista');
}
My Request looks like this:
public function messages()
{
return [
'nome_especie.required' => 'O campo nome é necessário'. $this->id_especie,
...
];
}
The error that laravel shows is this: "Call to a member function fill () on null"