ServiceProvider.php 716 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace iBrand\Express;
  3. use Illuminate\Support\Facades\Route;
  4. class ServiceProvider extends \Illuminate\Support\ServiceProvider
  5. {
  6. protected $namespace = 'iBrand\Express';
  7. public function boot()
  8. {
  9. if ($this->app->runningInConsole()) {
  10. $this->publishes([
  11. __DIR__ . '/../config/config.php' => config_path('ibrand/express.php'),
  12. ]);
  13. }
  14. if (!$this->app->routesAreCached()) {
  15. $routeAttr = config('ibrand.express.route', []);
  16. Route::group(array_merge(['namespace' => $this->namespace], $routeAttr), function ($router) {
  17. require __DIR__ . '/route.php';
  18. });
  19. }
  20. }
  21. public function register()
  22. {
  23. $this->mergeConfigFrom(__DIR__ . '/../config/config.php', 'ibrand.express');
  24. }
  25. }