DB::beginTransaction();
try{
//my logic
if(bad logic) throw new \Exception();
DB::commit();
return true;
}catch (\Exception $e) {
DB::rollback();
return false;
}
So what will happen if bad logic throws new exception? DB::commit() will not be called, so recored will not be saved in database. So why the hell I need to write DB:rollback() at all?