diff --git a/src/ModelObserver.php b/src/ModelObserver.php index ad93abdb..428d6c25 100644 --- a/src/ModelObserver.php +++ b/src/ModelObserver.php @@ -3,6 +3,7 @@ namespace Laravel\Scout; use Illuminate\Database\Eloquent\SoftDeletes; +use Illuminate\Support\Facades\Config; class ModelObserver { @@ -27,7 +28,7 @@ class ModelObserver */ public function __construct() { - $this->afterCommit = config('scout.after_commit', false); + $this->afterCommit = Config::get('scout.after_commit', false); } /** diff --git a/tests/AlgoliaEngineTest.php b/tests/AlgoliaEngineTest.php index 32538c3d..7e77a610 100644 --- a/tests/AlgoliaEngineTest.php +++ b/tests/AlgoliaEngineTest.php @@ -4,6 +4,7 @@ use Algolia\AlgoliaSearch\SearchClient; use Illuminate\Database\Eloquent\Collection; +use Illuminate\Support\Facades\Config; use Laravel\Scout\Builder; use Laravel\Scout\Engines\AlgoliaEngine; use Laravel\Scout\Tests\Fixtures\SearchableModel; @@ -13,6 +14,11 @@ class AlgoliaEngineTest extends TestCase { + protected function setUp(): void + { + Config::shouldReceive('get')->with('scout.after_commit', m::any())->andReturn(false); + } + protected function tearDown(): void { m::close(); diff --git a/tests/ModelObserverTest.php b/tests/ModelObserverTest.php index d51a3ea4..6fc58f5b 100644 --- a/tests/ModelObserverTest.php +++ b/tests/ModelObserverTest.php @@ -2,12 +2,18 @@ namespace Laravel\Scout\Tests; +use Illuminate\Support\Facades\Config; use Laravel\Scout\ModelObserver; use Mockery as m; use PHPUnit\Framework\TestCase; class ModelObserverTest extends TestCase { + protected function setUp(): void + { + Config::shouldReceive('get')->with('scout.after_commit', m::any())->andReturn(false); + } + protected function tearDown(): void { m::close();