| 1 | <?php |
||||
| 2 | |||||
| 3 | namespace Soap\Invoices\Providers; |
||||
| 4 | |||||
| 5 | use Illuminate\Support\ServiceProvider; |
||||
| 6 | use Soap\Invoices\Services\InvoiceService; |
||||
| 7 | use Soap\Invoices\Services\BillService; |
||||
| 8 | use Soap\Invoices\Interfaces\BillServiceInterface; |
||||
| 9 | use Soap\Invoices\Interfaces\InvoiceServiceInterface; |
||||
| 10 | |||||
| 11 | |||||
| 12 | class InvoiceServiceProvider extends ServiceProvider |
||||
| 13 | { |
||||
| 14 | /** |
||||
| 15 | * Perform post-registration booting of services. |
||||
| 16 | * |
||||
| 17 | * @return void |
||||
| 18 | */ |
||||
| 19 | public function boot() |
||||
| 20 | { |
||||
| 21 | $this->registerResources(); |
||||
| 22 | |||||
| 23 | $this->defineAssetPublishing(); |
||||
| 24 | |||||
| 25 | } |
||||
| 26 | |||||
| 27 | /** |
||||
| 28 | * Register any package services. |
||||
| 29 | * |
||||
| 30 | * @return void |
||||
| 31 | */ |
||||
| 32 | public function register() |
||||
| 33 | { |
||||
| 34 | $this->configure(); |
||||
| 35 | |||||
| 36 | $this->registerServices(); |
||||
| 37 | |||||
| 38 | } |
||||
| 39 | |||||
| 40 | /** |
||||
| 41 | * Setup the configuration for Invoices. |
||||
| 42 | * |
||||
| 43 | * @return void |
||||
| 44 | */ |
||||
| 45 | protected function configure() |
||||
| 46 | { |
||||
| 47 | $this->mergeConfigFrom(__DIR__ . '/../../config/soap.invoices.php', 'soap.invoices'); |
||||
| 48 | } |
||||
| 49 | |||||
| 50 | protected function registerResources() |
||||
| 51 | { |
||||
| 52 | $sourceViewsPath = __DIR__ . '/../../resources/views'; |
||||
| 53 | $this->loadViewsFrom($sourceViewsPath, 'invoices'); |
||||
| 54 | } |
||||
| 55 | |||||
| 56 | /** |
||||
| 57 | * Define the asset publishing configuration. |
||||
| 58 | * |
||||
| 59 | * @return void |
||||
| 60 | */ |
||||
| 61 | protected function defineAssetPublishing() |
||||
| 62 | { |
||||
| 63 | $sourceViewsPath = __DIR__ . '/../../resources/views'; |
||||
| 64 | |||||
| 65 | $this->publishes([ |
||||
| 66 | $sourceViewsPath => resource_path('views/vendor/invoices'), |
||||
| 67 | ], 'views'); |
||||
| 68 | |||||
| 69 | // Publish a config file |
||||
| 70 | $this->publishes([ |
||||
| 71 | __DIR__ . '/../../config/soap.invoices.php' => config_path('soap.invoices.php'), |
||||
| 72 | ], 'config'); |
||||
| 73 | |||||
| 74 | // Publish migrations |
||||
| 75 | $this->publishes([ |
||||
| 76 | __DIR__ . '/../../database/migrations/2020_02_10_163005_create_invoices_tables.php' |
||||
| 77 | => database_path('migrations/2020_02_10_163005_create_invoices_tables.php'), |
||||
| 78 | ], 'migrations'); |
||||
| 79 | } |
||||
| 80 | |||||
| 81 | /** |
||||
| 82 | * Setup the resource publishing groups for Invoices. |
||||
| 83 | * |
||||
| 84 | * @return void |
||||
| 85 | */ |
||||
| 86 | protected function offerPublishing() |
||||
| 87 | { |
||||
| 88 | if ($this->app->runningInConsole()) { |
||||
| 89 | // Publishing the configuration file. |
||||
| 90 | $this->publishes([ |
||||
| 91 | __DIR__ . '/../config/soap.invoices.php' => config_path('soap.invoices.php'), |
||||
| 92 | ], 'invoices.config'); |
||||
| 93 | |||||
| 94 | // Publishing the views. |
||||
| 95 | $this->publishes([ |
||||
| 96 | __DIR__ . '/../resources/views' => base_path('resources/views/vendor/invoices'), |
||||
| 97 | ], 'invoices.views'); |
||||
| 98 | |||||
| 99 | // Publishing the translation files. |
||||
| 100 | $this->publishes([ |
||||
| 101 | __DIR__ . '/../resources/lang' => resource_path('lang/vendor/invoices'), |
||||
| 102 | ], 'invoices.translations'); |
||||
| 103 | } |
||||
| 104 | } |
||||
| 105 | |||||
| 106 | protected function registerServices() |
||||
| 107 | { |
||||
| 108 | $this->app->bind(InvoiceServiceInterface::class, function ($app) { |
||||
|
0 ignored issues
–
show
|
|||||
| 109 | return new InvoiceService(); |
||||
| 110 | }); |
||||
| 111 | |||||
| 112 | $this->app->bind(BillServiceInterface::class, function ($app) { |
||||
|
0 ignored issues
–
show
The parameter
$app is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. Loading history...
|
|||||
| 113 | return new BillService(); |
||||
| 114 | }); |
||||
| 115 | } |
||||
| 116 | |||||
| 117 | /** |
||||
| 118 | * Get the services provided by the provider. |
||||
| 119 | * |
||||
| 120 | * @return array |
||||
| 121 | */ |
||||
| 122 | public function provides() |
||||
| 123 | { |
||||
| 124 | return ['invoice']; |
||||
| 125 | } |
||||
| 126 | } |
||||
| 127 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.