Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.x] Use the Config facade instead #442

Merged
merged 3 commits into from
Jan 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/ModelObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Laravel\Scout;

use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Facades\Config;

class ModelObserver
{
Expand All @@ -27,7 +28,7 @@ class ModelObserver
*/
public function __construct()
{
$this->afterCommit = config('scout.after_commit', false);
$this->afterCommit = Config::get('scout.after_commit', false);
}

/**
Expand Down
6 changes: 6 additions & 0 deletions tests/AlgoliaEngineTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
Expand Down
6 changes: 6 additions & 0 deletions tests/ModelObserverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down