Check whether multiple inserts have been successfully completed in Aravel

Asked

Viewed 56 times

1

Good morning programmers, I have an application that has a report with several insertions, I need to know if all were executed successfully, I’m using the DB library:

DB::insert('insert into laudo_exemplo(numero, pergunta, procedimento, fk_laudo)
                values (?,?,?,?)',
                [$num_2_11_1, $pergunta_2_11_1, $procesimento2_11_1 , $lastid]
            );

Does anyone know a method to check whether an insert like this has been successfully executed?

1 answer

0

Dude, it’s pretty simple, to know when a code has been successfully compiled, throw it into an IF. Example.

$sql = DB::insert('insert into laudo_exemplo(numero, pergunta, procedimento, fk_laudo) values (?,?,?,?)',[$num_2_11_1, $pergunta_2_11_1, $procesimento2_11_1 , $lastid]);

if($sql)
    return 'Sucesso';

return 'Erro';
  • It’s really that simple, I didn’t think of it rsrsrs thank you very much for the help

Browser other questions tagged

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