Updating in the database

Asked

Viewed 105 times

0

There is an error in the family composition, which says:

Undefined variable: compositionFamiliary

the family composition code is:

$composicaoFamiliar = DB::table('membro_familiar')->insertGetId([
    'id_identificacao_usuario'  =>$consulta[0]->id,
    'nome'                      =>$membroNome,
    'parentesco'                =>$membroParentesco,
    'idade'                     =>$membroIdade,
    'sexo'                      =>$membroSexo,
    'nis'                       =>$membroNis,
    'loas'                      =>$loas,
    'bolsaFamilia'              =>$bolsa_familia,
    'previdencia'               =>$previdencia,
    'renda'                     =>$rendaUsuario,
]);

And the code that is referenced to this variable is this:

if ($situacaoFinanceira == 1 || $vulnerabilidade == 1 || $endereco == 1 
    || $identificacaoPessoa == 1 || $composicaoFamiliar !=  null) {
    DB::commit();
    alert()->success('', 'Cadastro atualizado com sucesso!')->autoclose(2000);
    return Redirect::to('/family');
}else{
    DB::rollback();
    alert()->error('Verifique as informações', 'Não foi possível atualizar o cadasto')->autoclose(3000);
    return Redirect::to('/family');
}

How do I solve?

  • Friend, put the full code of the method but leave the one you already put.

  • Are you redirecting to "/family", what is done in this method? or is the error before that? put the full code!

  • already solved, the error was on the route, the redirect logic was wrong, for those who have the same error analyze your routes and see if you are redirecting to the right place

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.