In codeigniter we have command trans_status()
that check transaction is successful or not:
if ($this->db->trans_status() === FALSE)
{
// error woun't be generated...
}
i want to know laravel 5.*
have any like that?
Yes, you can get transaction status in laravel like this. Laravel Manual for DB::transaction
/**
* @return boolean
*/
public function transactionalQuery()
{
try {
DB::transaction(function ($data) {
// do something
});
} catch (\Exception $e) {
return false;
}
return true;
}
Reference Code
Author Name: JarekTkaczyk
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