Reputation: 520
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?
Upvotes: 4
Views: 2858
Reputation: 4066
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;
}
Author Name: JarekTkaczyk
Upvotes: 11