These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Spatie\WebTinker; |
||
4 | |||
5 | use Illuminate\Support\Facades\Gate; |
||
6 | use Illuminate\Support\Facades\Route; |
||
7 | use Illuminate\Support\ServiceProvider; |
||
8 | use Spatie\WebTinker\Console\InstallCommand; |
||
9 | use Spatie\WebTinker\Http\Middleware\Authorize; |
||
10 | use Spatie\WebTinker\Http\Controllers\WebTinkerController; |
||
11 | |||
12 | class WebTinkerServiceProvider extends ServiceProvider |
||
13 | { |
||
14 | public function boot() |
||
15 | { |
||
16 | if ($this->app->runningInConsole()) { |
||
17 | $this->publishes([ |
||
18 | __DIR__.'/../config/web-tinker.php' => config_path('web-tinker.php'), |
||
19 | ], 'config'); |
||
20 | |||
21 | $this->publishes([ |
||
22 | __DIR__.'/../resources/views' => base_path('resources/views/vendor/web-tinker'), |
||
23 | ], 'views'); |
||
24 | |||
25 | $this->publishes([ |
||
26 | __DIR__.'/../public' => public_path('vendor/web-tinker'), |
||
27 | ], 'web-tinker-assets'); |
||
28 | } |
||
29 | |||
30 | $this->loadViewsFrom(__DIR__.'/../resources/views', 'web-tinker'); |
||
31 | |||
32 | $this |
||
33 | ->registerRoutes() |
||
34 | ->registerWebTinkerGate(); |
||
35 | } |
||
36 | |||
37 | public function register() |
||
38 | { |
||
39 | $this->mergeConfigFrom(__DIR__.'/../config/web-tinker.php', 'web-tinker'); |
||
40 | |||
41 | $this->commands(InstallCommand::class); |
||
42 | } |
||
43 | |||
44 | protected function registerRoutes() |
||
45 | { |
||
46 | Route::prefix(config('web-tinker.path'))->middleware(Authorize::class)->group(function () { |
||
47 | Route::get('/', [WebTinkerController::class, 'index']); |
||
48 | Route::post('/', [WebTinkerController::class, 'execute']); |
||
49 | }); |
||
50 | |||
51 | return $this; |
||
52 | } |
||
53 | |||
54 | protected function registerWebTinkerGate() |
||
55 | { |
||
56 | Gate::define('viewWebTinker', function ($user = null) { |
||
0 ignored issues
–
show
|
|||
57 | return app()->environment('local'); |
||
58 | }); |
||
59 | |||
60 | return $this; |
||
61 | } |
||
62 | } |
||
63 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.