File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ trait Auditable
4545 */
4646 public static function bootAuditable ()
4747 {
48- if (static ::isAuditingEnabled ()) {
48+ if (! self :: $ auditingDisabled && static ::isAuditingEnabled ()) {
4949 static ::observe (new AuditableObserver ());
5050 }
5151 }
Original file line number Diff line number Diff line change @@ -65,6 +65,21 @@ public function itWillAlwaysAuditModelsWhenNotRunningFromTheConsole()
6565 $ this ->assertTrue (Article::isAuditingEnabled ());
6666 }
6767
68+ /**
69+ * @group Auditable::bootAuditable
70+ * @test
71+ */
72+ public function itWillNotBootTraitWhenStaticFlagIsSet ()
73+ {
74+ App::spy ();
75+
76+ Article::$ auditingDisabled = true ;
77+
78+ new Article ();
79+
80+ App::shouldNotHaveReceived ('runningInConsole ' );
81+ }
82+
6883 /**
6984 * @group Auditable::getAuditEvent
7085 * @test
You can’t perform that action at this time.
0 commit comments