1 | <?php |
||
2 | |||
3 | namespace PhpCollective\MenuMaker; |
||
4 | |||
5 | use Blade; |
||
6 | use View; |
||
7 | use Route; |
||
8 | use Illuminate\Support\ServiceProvider; |
||
9 | use PhpCollective\MenuMaker\Storage\Menu; |
||
10 | use PhpCollective\MenuMaker\Storage\Role; |
||
11 | use Illuminate\Auth\SessionGuard as AuthGuard; |
||
12 | use PhpCollective\MenuMaker\Observers\MenuObserver; |
||
13 | use PhpCollective\MenuMaker\Observers\RoleObserver; |
||
14 | |||
15 | class MenuServiceProvider extends ServiceProvider |
||
16 | { |
||
17 | /** |
||
18 | * Bootstrap any application services. |
||
19 | * |
||
20 | * @return void |
||
21 | */ |
||
22 | public function boot() |
||
23 | { |
||
24 | Role::observe(RoleObserver::class); |
||
25 | Menu::observe(MenuObserver::class); |
||
26 | |||
27 | AuthGuard::macro('menus', function ($section) { |
||
28 | return $this->user()->menus($section); |
||
0 ignored issues
–
show
|
|||
29 | }); |
||
30 | |||
31 | Blade::if('approve', function ($menu) { |
||
32 | return auth()->user()->approve($menu); |
||
33 | }); |
||
34 | |||
35 | Route::model('user', '\\' . ltrim(config('auth.providers.users.model'), '\\')); |
||
36 | |||
37 | $this->registerRoutes(); |
||
38 | $this->registerMigrations(); |
||
39 | $this->registerPublishing(); |
||
40 | |||
41 | View::addNamespace('menu-maker', resource_path('views/menu-maker')); |
||
42 | |||
43 | $this->loadTranslationsFrom( |
||
44 | __DIR__ . '/../resources/lang', 'menu-maker' |
||
45 | ); |
||
46 | } |
||
47 | |||
48 | /** |
||
49 | * Register the package routes. |
||
50 | * |
||
51 | * @return void |
||
52 | */ |
||
53 | private function registerRoutes() |
||
54 | { |
||
55 | Route::group($this->routeConfiguration(), function () { |
||
56 | $this->loadRoutesFrom(__DIR__ . '/Http/routes.php'); |
||
57 | }); |
||
58 | } |
||
59 | |||
60 | /** |
||
61 | * Get the Menu Maker route group configuration array. |
||
62 | * |
||
63 | * @return array |
||
64 | */ |
||
65 | private function routeConfiguration() |
||
66 | { |
||
67 | return [ |
||
68 | 'namespace' => 'PhpCollective\MenuMaker\Http\Controllers', |
||
69 | 'prefix' => config('menu.path'), |
||
70 | 'middleware' => ['web', 'auth', 'menu'], |
||
71 | ]; |
||
72 | } |
||
73 | |||
74 | /** |
||
75 | * Register the package's migrations. |
||
76 | * |
||
77 | * @return void |
||
78 | */ |
||
79 | private function registerMigrations() |
||
80 | { |
||
81 | if ($this->app->runningInConsole()) { |
||
82 | $this->loadMigrationsFrom(__DIR__ . '/Storage/migrations'); |
||
83 | } |
||
84 | } |
||
85 | |||
86 | /** |
||
87 | * Register the package's publishable resources. |
||
88 | * |
||
89 | * @return void |
||
90 | */ |
||
91 | private function registerPublishing() |
||
92 | { |
||
93 | if ($this->app->runningInConsole()) { |
||
94 | $this->publishes([ |
||
95 | __DIR__ . '/Storage/migrations' => database_path('migrations'), |
||
96 | ], 'menu-migrations'); |
||
97 | |||
98 | $this->publishes([ |
||
99 | __DIR__ . '/../public' => public_path('vendor/menu-maker'), |
||
100 | ], 'menu-assets'); |
||
101 | |||
102 | $this->publishes([ |
||
103 | __DIR__ . '/../config/menu.php' => config_path('menu.php'), |
||
104 | ], 'menu-config'); |
||
105 | |||
106 | $this->publishes([ |
||
107 | __DIR__.'/Storage/seeds' => database_path('seeds'), |
||
108 | ], 'menu-seeder'); |
||
109 | |||
110 | $this->publishes([ |
||
111 | __DIR__.'/../resources/views' => resource_path('views/menu-maker'), |
||
112 | ], 'menu-views'); |
||
113 | } |
||
114 | } |
||
115 | |||
116 | /** |
||
117 | * Register any application services. |
||
118 | * |
||
119 | * @return void |
||
120 | */ |
||
121 | public function register() |
||
122 | { |
||
123 | $this->app->bind('userModel', function () { |
||
124 | $class = '\\' . ltrim(config('auth.providers.users.model'), '\\'); |
||
125 | |||
126 | return new $class; |
||
127 | }); |
||
128 | |||
129 | $this->mergeConfigFrom( |
||
130 | __DIR__ . '/../config/menu.php', 'menu' |
||
131 | ); |
||
132 | |||
133 | $this->commands([ |
||
134 | Console\ClearCommand::class, |
||
135 | Console\InstallCommand::class, |
||
136 | Console\PublishCommand::class, |
||
137 | ]); |
||
138 | } |
||
139 | } |
||
140 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.