Problems with select when sending data by POST. laravel 5.5

Posted 4 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.

https://paste.laravel.io/01a2ce91-4dc2-4160-b746-b6af50cd42b9

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)
         {

           $request->user()->authorizeRoles(['admin']);
           $comprobarr=usuarios::where('id', $id)->get();
              if ($comprobarr->isNotEmpty())
                   {

                        $usuarios=usuarios::find($id);
                        $gobernadorf=($usuarios->gobe_id);
                        $alcaldef=($usuarios->alcal_id);
                        $consejof=($usuarios->conse_id);
                        $asambleaf=($usuarios->asam_id);
                        $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]);

                   }
              else
                   {

                       return view('usuario.error');
                   }

          }

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

Reply to

Use Markdown with GitHub-flavored code blocks.