Issues (57)

src/BlueprintMacroServiceProvider.php (1 issue)

1
<?php
2
3
namespace CleaniqueCoders\Blueprint\Macro;
4
5
use Illuminate\Support\ServiceProvider;
6
7
class BlueprintMacroServiceProvider extends ServiceProvider
8
{
9
    /**
10
     * Bootstrap the application services.
11
     */
12
    public function boot()
13
    {
14
        collect(glob(__DIR__.'/Database/Schema/macros/*.php'))
15
            ->each(function ($path) {
16
                require $path;
17
            });
18
19
        /* A little hack to have Builder::hasMacro */
20
        \Illuminate\Database\Eloquent\Builder::macro('hasMacro', function ($name) {
21
            return isset(static::$macros[$name]);
0 ignored issues
show
Bug Best Practice introduced by
The property macros does not exist on CleaniqueCoders\Blueprin...intMacroServiceProvider. Did you maybe forget to declare it?
Loading history...
22
        });
23
24
        collect(glob(__DIR__.'/Models/macros/*.php'))
25
            ->each(function ($path) {
26
                require $path;
27
            });
28
    }
29
30
    /**
31
     * Register the application services.
32
     */
33
    public function register()
34
    {
35
    }
36
}
37