7 months ago

Problems with select when sending data by POST. laravel 5.5

Posted 7 months ago by daniel21gt

I have the following html code, my problem is that in the end I have 4 select, which work well, I extract correct information.


The problem is when I send this by POST to the update driver, since I have this error.

"SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'gobe_id' cannot be null (SQL: update usuarios set gobe_id = , alcal_id = , conse_id = , `a ▶"

I do not understand why, in actuality, the select ones have records, but when sending them, they do not send anything, why could this happen?

the select well extract the information, come from this method.

public function edit(Request $request, $id) {

      $registrado = \Auth::user()->tipos_usuarios_id;

      if($registrado == 1)

           $comprobarr=usuarios::where('id', $id)->get();
              if ($comprobarr->isNotEmpty())

                        $governor=governor::select('governor_candidate')->orderByRaw("FIELD(id, $gobernadorf) DESC")->get();
                        $mayor=mayor::select('mayor_candidate')->orderByRaw("FIELD(id, $alcaldef) DESC")->get();
                        $advice=advice::select('advice_candidate')->orderByRaw("FIELD(id, $consejof) DESC")->get();
                        $assembly=assembly::select('assembly_candidate')->orderByRaw("FIELD(id, $asambleaf) DESC")->get();
                        return view('usuario.edit')->with(['usuarios' => $usuarios ,'governor' => $governor, 'mayor' => $mayor, 'advice' => $advice, 'assembly' => $assembly]);


                       return view('usuario.error');


Please sign in or create an account to participate in this conversation.