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\OutputModifiers\OutputModifier; |
||
11 | use Spatie\WebTinker\Http\Controllers\WebTinkerController; |
||
12 | |||
13 | class WebTinkerServiceProvider extends ServiceProvider |
||
14 | { |
||
15 | public function boot() |
||
16 | { |
||
17 | if ($this->app->runningInConsole()) { |
||
18 | $this->publishes([ |
||
19 | __DIR__.'/../config/web-tinker.php' => config_path('web-tinker.php'), |
||
20 | ], 'config'); |
||
21 | |||
22 | $this->publishes([ |
||
23 | __DIR__.'/../resources/views' => base_path('resources/views/vendor/web-tinker'), |
||
24 | ], 'views'); |
||
25 | |||
26 | $this->publishes([ |
||
27 | __DIR__.'/../public' => public_path('vendor/web-tinker'), |
||
28 | ], 'web-tinker-assets'); |
||
29 | } |
||
30 | |||
31 | $this->loadViewsFrom(__DIR__.'/../resources/views', 'web-tinker'); |
||
32 | |||
33 | $this->app->bind(OutputModifier::class, config('web-tinker.output_modifier')); |
||
34 | |||
35 | $this |
||
36 | ->registerRoutes() |
||
37 | ->registerWebTinkerGate(); |
||
38 | } |
||
39 | |||
40 | public function register() |
||
41 | { |
||
42 | $this->mergeConfigFrom(__DIR__.'/../config/web-tinker.php', 'web-tinker'); |
||
43 | |||
44 | $this->commands(InstallCommand::class); |
||
45 | } |
||
46 | |||
47 | protected function registerRoutes() |
||
48 | { |
||
49 | Route::prefix(config('web-tinker.path'))->middleware(Authorize::class)->group(function () { |
||
50 | Route::get('/', [WebTinkerController::class, 'index']); |
||
51 | Route::post('/', [WebTinkerController::class, 'execute']); |
||
52 | }); |
||
53 | |||
54 | return $this; |
||
55 | } |
||
56 | |||
57 | protected function registerWebTinkerGate() |
||
58 | { |
||
59 | Gate::define('viewWebTinker', function ($user = null) { |
||
0 ignored issues
–
show
|
|||
60 | return app()->environment('local'); |
||
61 | }); |
||
62 | |||
63 | return $this; |
||
64 | } |
||
65 | } |
||
66 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.