We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8155c26 commit 2d1e4bfCopy full SHA for 2d1e4bf
src/Auditable.php
@@ -75,7 +75,7 @@ trait Auditable
75
*/
76
public static function bootAuditable()
77
{
78
- if (static::isAuditingEnabled()) {
+ if (App::getFacadeRoot() && static::isAuditingEnabled()) {
79
static::observe(new AuditableObserver);
80
}
81
tests/Unit/OutsideOfAppContextTest.php
@@ -0,0 +1,15 @@
1
+<?php
2
+
3
+namespace OwenIt\Auditing\Tests\Unit;
4
5
+use OwenIt\Auditing\Tests\Models\Article;
6
+use PHPUnit\Framework\TestCase;
7
8
+class OutsideOfAppContextTest extends TestCase
9
+{
10
+ public function test_can_create_new_model(): void
11
+ {
12
+ $article = new Article();
13
+ $this->assertInstanceOf(Article::class, $article);
14
+ }
15
+}
0 commit comments