File tree Expand file tree Collapse file tree 2 files changed +16
-10
lines changed Expand file tree Collapse file tree 2 files changed +16
-10
lines changed Original file line number Diff line number Diff line change 2828 ['url ' => env ('APP_URL ' ).'/api ' , 'description ' => 'Default Environment ' ],
2929 ],
3030 ],
31+ 'transactions ' => [
32+ 'enabled ' => false ,
33+ ],
3134];
Original file line number Diff line number Diff line change 66
77trait HandlesTransactions
88{
9- /**
10- * Flag to enable or disable transactions
11- *
12- * @var boolean
13- */
14- protected $ transactionsEnabled = false ;
15-
169 /**
1710 * Start database transaction
1811 *
1912 * @return void
2013 */
2114 protected function startTransaction (): void
2215 {
23- if ($ this ->transactionsEnabled !== true ) {
16+ if ($ this ->transactionsAreEnabled () !== true ) {
2417 return ;
2518 }
2619
@@ -35,7 +28,7 @@ protected function startTransaction(): void
3528 */
3629 protected function commitTransaction (): void
3730 {
38- if ($ this ->transactionsEnabled !== true ) {
31+ if ($ this ->transactionsAreEnabled () !== true ) {
3932 return ;
4033 }
4134
@@ -50,7 +43,7 @@ protected function commitTransaction(): void
5043 */
5144 protected function rollbackTransaction (): void
5245 {
53- if ($ this ->transactionsEnabled !== true ) {
46+ if ($ this ->transactionsAreEnabled () !== true ) {
5447 return ;
5548 }
5649
@@ -72,4 +65,14 @@ protected function rollbackTransactionAndRaise(\Exception $exception): void
7265
7366 throw $ exception ;
7467 }
68+
69+ /**
70+ * Return configuration value
71+ *
72+ * @return boolean
73+ */
74+ protected function transactionsAreEnabled (): bool
75+ {
76+ return (bool )config ('orion.transactions.enabled ' , false );
77+ }
7578}
You can’t perform that action at this time.
0 commit comments