@@ -46,39 +46,25 @@ trait NodeTrait
46
46
public static function bootNodeTrait ()
47
47
{
48
48
static ::saving (function ($ model ) {
49
- $ model ->getConnection ()->beginTransaction ();
50
-
51
49
return $ model ->callPendingAction ();
52
50
});
53
51
54
- static ::saved (function ($ model ) {
55
- $ model ->getConnection ()->commit ();
56
- });
57
-
58
52
static ::deleting (function ($ model ) {
59
- $ model ->getConnection ()->beginTransaction ();
60
-
61
53
// We will need fresh data to delete node safely
62
54
$ model ->refreshNode ();
63
55
});
64
56
65
57
static ::deleted (function ($ model ) {
66
58
$ model ->deleteDescendants ();
67
-
68
- $ model ->getConnection ()->commit ();
69
59
});
70
60
71
61
if (static ::usesSoftDelete ()) {
72
62
static ::restoring (function ($ model ) {
73
- $ model ->getConnection ()->beginTransaction ();
74
-
75
63
static ::$ deletedAt = $ model ->{$ model ->getDeletedAtColumn ()};
76
64
});
77
65
78
66
static ::restored (function ($ model ) {
79
67
$ model ->restoreDescendants (static ::$ deletedAt );
80
-
81
- $ model ->getConnection ()->commit ();
82
68
});
83
69
}
84
70
}
@@ -1140,11 +1126,12 @@ protected function dirtyBounds()
1140
1126
{
1141
1127
$ this ->original [$ this ->getLftName ()] = null ;
1142
1128
$ this ->original [$ this ->getRgtName ()] = null ;
1129
+
1143
1130
return $ this ;
1144
1131
}
1145
1132
1146
1133
/**
1147
- * @param NodeTrait $node
1134
+ * @param self $node
1148
1135
*
1149
1136
* @return $this
1150
1137
*/
@@ -1158,7 +1145,7 @@ protected function assertNotDescendant(self $node)
1158
1145
}
1159
1146
1160
1147
/**
1161
- * @param NodeTrait $node
1148
+ * @param self $node
1162
1149
*
1163
1150
* @return $this
1164
1151
*/
0 commit comments