I am trying this:
  $iddocente = '1';
  $idcurso = '2';
  DB::transaction(function() {
    DB::table('users')->insert(
      array('docente' => $iddocente, 'curso' => $idcurso)
    );
  });
But no work. Help me please.
The use keyword is what you want.
DB::transaction(function() use ($iddocente, $idcurso) {
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With