1 | <?php namespace Blok\JavaScript; |
||
2 | |||
3 | use Illuminate\Support\Facades\Blade; |
||
4 | use Illuminate\Support\ServiceProvider; |
||
5 | |||
6 | class JavaScriptServiceProvider extends ServiceProvider |
||
7 | { |
||
8 | protected $defer = false; |
||
9 | |||
10 | public function register() |
||
11 | { |
||
12 | $this->app->singleton('JavaScript', function ($app) { |
||
0 ignored issues
–
show
|
|||
13 | return new JavaScript(config('javascript.namespace')); |
||
14 | }); |
||
15 | } |
||
16 | |||
17 | public function boot() |
||
18 | { |
||
19 | require_once __DIR__ . '/helpers.php'; |
||
20 | |||
21 | $this->publishes([ |
||
22 | __DIR__ . '/config/javascript.php' => config_path('javascript.php'), |
||
23 | ], 'config'); |
||
24 | |||
25 | /** |
||
26 | * @example |
||
27 | * @javascript($namespace, (optional) $array) |
||
28 | */ |
||
29 | Blade::directive('javascript', function ($expression) { |
||
30 | return "<?php echo JavaScript::render({$expression}); ?>"; |
||
31 | }); |
||
32 | } |
||
33 | } |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.