1 | <?php |
||||
2 | |||||
3 | namespace Spatie\WebTinker; |
||||
4 | |||||
5 | use Illuminate\Cookie\Middleware\EncryptCookies; |
||||
6 | use Illuminate\Session\Middleware\StartSession; |
||||
7 | use Illuminate\Support\Facades\Gate; |
||||
8 | use Illuminate\Support\Facades\Route; |
||||
9 | use Illuminate\Support\ServiceProvider; |
||||
10 | use Spatie\WebTinker\Console\InstallCommand; |
||||
11 | use Spatie\WebTinker\Http\Controllers\WebTinkerController; |
||||
12 | use Spatie\WebTinker\Http\Middleware\Authorize; |
||||
13 | use Spatie\WebTinker\OutputModifiers\OutputModifier; |
||||
14 | |||||
15 | class WebTinkerServiceProvider extends ServiceProvider |
||||
16 | { |
||||
17 | public function boot() |
||||
18 | { |
||||
19 | if ($this->app->runningInConsole()) { |
||||
20 | $this->publishes([ |
||||
21 | __DIR__.'/../config/web-tinker.php' => config_path('web-tinker.php'), |
||||
22 | ], 'config'); |
||||
23 | |||||
24 | $this->publishes([ |
||||
25 | __DIR__.'/../resources/views' => base_path('resources/views/vendor/web-tinker'), |
||||
26 | ], 'views'); |
||||
27 | |||||
28 | $this->publishes([ |
||||
29 | __DIR__.'/../public' => public_path('vendor/web-tinker'), |
||||
30 | ], 'web-tinker-assets'); |
||||
31 | } |
||||
32 | |||||
33 | $this->loadViewsFrom(__DIR__.'/../resources/views', 'web-tinker'); |
||||
34 | |||||
35 | $this->app->bind(OutputModifier::class, config('web-tinker.output_modifier')); |
||||
36 | |||||
37 | $this |
||||
38 | ->registerRoutes() |
||||
39 | ->registerWebTinkerGate(); |
||||
40 | } |
||||
41 | |||||
42 | public function register() |
||||
43 | { |
||||
44 | $this->mergeConfigFrom(__DIR__.'/../config/web-tinker.php', 'web-tinker'); |
||||
45 | |||||
46 | $this->commands(InstallCommand::class); |
||||
47 | } |
||||
48 | |||||
49 | protected function registerRoutes() |
||||
50 | { |
||||
51 | Route::prefix(config('web-tinker.path'))->middleware([ |
||||
52 | EncryptCookies::class, |
||||
53 | StartSession::class, |
||||
54 | Authorize::class, |
||||
55 | ])->group(function () { |
||||
56 | Route::get('/', [WebTinkerController::class, 'index']); |
||||
57 | Route::post('/', [WebTinkerController::class, 'execute']); |
||||
58 | }); |
||||
59 | |||||
60 | return $this; |
||||
61 | } |
||||
62 | |||||
63 | protected function registerWebTinkerGate() |
||||
64 | { |
||||
65 | Gate::define('viewWebTinker', function ($user = null) { |
||||
0 ignored issues
–
show
|
|||||
66 | return app()->environment('local'); |
||||
0 ignored issues
–
show
The method
environment() does not exist on Illuminate\Container\Container . Are you sure you never get this type here, but always one of the subclasses?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
67 | }); |
||||
68 | |||||
69 | return $this; |
||||
70 | } |
||||
71 | } |
||||
72 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.