| @@ 7-41 (lines=35) @@ | ||
| 4 | use Illuminate\Support\ServiceProvider; |
|
| 5 | use Symfony\Component\Process\ProcessBuilder; |
|
| 6 | ||
| 7 | class ZbarQrdecoderServiceProviderLaravel4 extends ServiceProvider { |
|
| 8 | ||
| 9 | /** |
|
| 10 | * Bootstrap the application events. |
|
| 11 | * |
|
| 12 | * @return void |
|
| 13 | */ |
|
| 14 | public function boot() |
|
| 15 | { |
|
| 16 | ||
| 17 | $this->package('robbiep/zbar-qrdecoder'); |
|
| 18 | } |
|
| 19 | ||
| 20 | /** |
|
| 21 | * Register the service provider. |
|
| 22 | * |
|
| 23 | * @return void |
|
| 24 | */ |
|
| 25 | public function register() |
|
| 26 | { |
|
| 27 | $this->app['zbardecoder'] = $this->app->share(function($app) |
|
| 28 | { |
|
| 29 | $processBuilder = new ProcessBuilder(); |
|
| 30 | $config = $app['config']->get('zbar-qrdecoder::config'); |
|
| 31 | return new ZbarDecoder($config, $processBuilder); |
|
| 32 | }); |
|
| 33 | ||
| 34 | $this->app->booting(function() |
|
| 35 | { |
|
| 36 | $loader = AliasLoader::getInstance(); |
|
| 37 | $loader->alias('ZbarDecoder', 'RobbieP\ZbarQrdecoder\Facades\ZbarDecoder'); |
|
| 38 | }); |
|
| 39 | } |
|
| 40 | ||
| 41 | } |
|
| 42 | ||
| @@ 7-42 (lines=36) @@ | ||
| 4 | use Illuminate\Support\ServiceProvider; |
|
| 5 | use Symfony\Component\Process\ProcessBuilder; |
|
| 6 | ||
| 7 | class ZbarQrdecoderServiceProviderLaravel5 extends ServiceProvider { |
|
| 8 | ||
| 9 | /** |
|
| 10 | * Bootstrap the application events. |
|
| 11 | * |
|
| 12 | * @return void |
|
| 13 | */ |
|
| 14 | public function boot() |
|
| 15 | { |
|
| 16 | $this->publishes([ |
|
| 17 | __DIR__ . '/../../config/config.php' => config_path('zbar-qrdecoder.php'), |
|
| 18 | ]); |
|
| 19 | } |
|
| 20 | ||
| 21 | /** |
|
| 22 | * Register the service provider. |
|
| 23 | * |
|
| 24 | * @return void |
|
| 25 | */ |
|
| 26 | public function register() |
|
| 27 | { |
|
| 28 | $this->app['zbardecoder'] = $this->app->share(function($app) |
|
| 29 | { |
|
| 30 | $processBuilder = new ProcessBuilder(); |
|
| 31 | $config = $app['config']->get('zbar-qrdecoder::config'); |
|
| 32 | return new ZbarDecoder($config, $processBuilder); |
|
| 33 | }); |
|
| 34 | ||
| 35 | $this->app->booting(function() |
|
| 36 | { |
|
| 37 | $loader = AliasLoader::getInstance(); |
|
| 38 | $loader->alias('ZbarDecoder', 'RobbieP\ZbarQrdecoder\Facades\ZbarDecoder'); |
|
| 39 | }); |
|
| 40 | } |
|
| 41 | ||
| 42 | } |
|
| 43 | ||