Skip to content

Commit

Permalink
Merge pull request laravel#192 from morloderex/add-macroable
Browse files Browse the repository at this point in the history
Add macroable to scout builder
  • Loading branch information
taylorotwell authored May 31, 2017
2 parents c822eaf + 353cb48 commit 18992a2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
namespace Laravel\Scout;

use Illuminate\Pagination\Paginator;
use Illuminate\Support\Traits\Macroable;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Pagination\LengthAwarePaginator;

class Builder
{
use Macroable;

/**
* The model instance.
*
Expand Down
12 changes: 12 additions & 0 deletions tests/BuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,16 @@ public function test_pagination_correctly_handles_paginated_results()

$builder->paginate();
}

public function testMacroable()
{
Builder::macro('foo', function () {
return 'bar';
});

$builder = new Builder($model = Mockery::mock(), 'zonda');
$this->assertEquals(
'bar', $builder->foo()
);
}
}

0 comments on commit 18992a2

Please sign in to comment.