diff --git a/src/Libs/Model.php b/src/Libs/Model.php index 0d85b24..81936ed 100644 --- a/src/Libs/Model.php +++ b/src/Libs/Model.php @@ -72,9 +72,12 @@ class Model { * * @return bool */ - public function beginTransaction(): bool + public function rollBack(): bool { - return static::db()->beginTransaction(); + if ( static::db()->inTransaction()) + return static::db()->rollBack(); + else + return true; } /** @@ -83,9 +86,12 @@ class Model { * * @return bool */ - public function rollBack(): bool + public function commit(): bool { - return static::db()->rollBack(); + if (static::db()->inTransaction()) + return static::db()->commit(); + else + return true; } /**