File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -23,23 +23,39 @@ public function definition()
2323 'assigned_to_id ' => User::factory (),
2424 ];
2525 }
26+ protected static bool $ skipActionLog = false ;
27+
28+ public function withoutActionLog (): static
29+ {
30+ // turn off for this create() call
31+ static ::$ skipActionLog = true ;
32+
33+ // ensure it turns back on AFTER creating
34+ return $ this ->afterCreating (function () {
35+ static ::$ skipActionLog = false ;
36+ });
37+ }
2638
2739 public function configure (): static
2840 {
2941 return $ this ->afterCreating (function (CheckoutAcceptance $ acceptance ) {
42+ if (static ::$ skipActionLog ) {
43+ return ; // short-circuit
44+ }
3045 if ($ acceptance ->checkoutable instanceof Asset) {
3146 $ this ->createdAssociatedActionLogEntry ($ acceptance );
3247 }
3348
3449 if ($ acceptance ->checkoutable instanceof Asset && $ acceptance ->assignedTo instanceof User) {
3550 $ acceptance ->checkoutable ->update ([
36- 'assigned_to ' => $ acceptance ->assigned_to_id ,
37- 'assigned_type ' => get_class ($ acceptance ->assignedTo ),
51+ 'assigned_to ' => $ acceptance ->assigned_to_id ,
52+ 'assigned_type ' => get_class ($ acceptance ->assignedTo ),
3853 ]);
3954 }
4055 });
4156 }
4257
58+
4359 public function forAccessory ()
4460 {
4561 return $ this ->state ([
You can’t perform that action at this time.
0 commit comments