Skip to content

Commit

Permalink
Workaround on hasMacro not found
Browse files Browse the repository at this point in the history
  • Loading branch information
nasrulhazim committed Aug 20, 2018
1 parent ea0bd44 commit b851e5f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/BlueprintMacroServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ public function boot()
require $path;
});

/* A little hack to have Builder::hasMacro */
\Illuminate\Database\Eloquent\Builder::macro('hasMacro', function($name) {
return isset(static::$macros[$name]);
});

collect(glob(__DIR__ . '/Models/macros/*.php'))
->each(function($path) {
require $path;
Expand Down
2 changes: 1 addition & 1 deletion tests/AvailableMacroTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace CleaniqueCoders\Blueprint\Macro\Tests;

use Illuminate\Database\Query\Builder;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Schema\Blueprint;

class AvailableMacroTest extends TestCase
Expand Down

0 comments on commit b851e5f

Please sign in to comment.