lundi 17 juillet 2017

laravel save multiple records with different checkbox values

I have a form with some checkbox and i want to save all values of the checkbox in multiple records like save one value per record

       for($i=0; $i > $checkboc_count; $i++) {
          $destinatario = new Destinatario();
          $destinatario->acao_id = $acao1->id;
          if ($request->outros != null) {
            $destinatario->outros = $request->outros;
          }
          $destinatario->grupo_id = $request->get('grupos.' + $i);
          $destinatario->save();
}

now i have this but its not working. the record is not save and there is no error returned.

Can anyone help me? THX

Aucun commentaire:

Enregistrer un commentaire