0
I have a problem to validate the update on Laravel.
My Controller is 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 is like this:
public function messages()
{
return [
'nome_especie.required' => 'O campo nome é necessário'. $this->id_especie,
...
];
}
The error that the Laravel shows is this: "Call to a Member Function Fill() on null"
Of a
var_dump($esp);
, may$esp
is no value, or the variable$valores
is receiving null.– NoobSaibot
have to check
$especie
if you returned any data– novic
function editar(EspecieRequest $request, Especie $esp)
That’s what’s weird ...!– novic
The $esp had not I made in trial and error, I did the var_dump of $esp and $values and locked my pc, then I did a variable only, I do not remember which and I saw that left a junk memory in it
– lipesmile