diff --git a/.editorconfig b/.editorconfig index b61cb7de4..6537ca467 100644 --- a/.editorconfig +++ b/.editorconfig @@ -11,5 +11,5 @@ trim_trailing_whitespace = true [*.md] trim_trailing_whitespace = false -[{*.yml,yaml}] +[*.{yml,yaml}] indent_size = 2 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 928c65423..3c3008e4c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -16,7 +16,7 @@ jobs: fail-fast: true matrix: php: [7.2, 7.3, 7.4] - laravel: [^6.0, ^7.0] + laravel: [^6.0, ^7.0, ^8.0] include: - laravel: ^7.0 testbench: ^5.0 diff --git a/composer.json b/composer.json index 32fa0a84f..3a3f218df 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ "require": { "php": "^7.2", "ext-json": "*", - "laravel/framework": "^6.0|^7.0" + "laravel/framework": "^6.0|^7.0|^8.0" }, "require-dev": { "mockery/mockery": "^1.3|^1.4", diff --git a/src/CanvasServiceProvider.php b/src/CanvasServiceProvider.php index cb0b61c7f..338210584 100644 --- a/src/CanvasServiceProvider.php +++ b/src/CanvasServiceProvider.php @@ -16,39 +16,30 @@ class CanvasServiceProvider extends ServiceProvider { /** - * Bootstrap any package services. + * Register any application services. * * @return void - * @throws BindingResolutionException */ - public function boot() + public function register() { - $this->registerEvents(); - $this->registerRoutes(); - $this->registerMigrations(); - $this->registerPublishing(); - $this->loadViewsFrom(__DIR__.'/../resources/views', 'canvas'); - $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'canvas'); + $this->mergeConfigFrom(__DIR__.'/../config/canvas.php', 'canvas'); } /** - * Register bindings in the container. + * Bootstrap any application services. * * @return void + * @throws BindingResolutionException */ - public function register() + public function boot() { - $this->mergeConfigFrom( - __DIR__.'/../config/canvas.php', - 'canvas' - ); - - $this->commands([ - AdminCommand::class, - DigestCommand::class, - InstallCommand::class, - PublishCommand::class, - ]); + $this->loadViewsFrom(__DIR__.'/../resources/views', 'canvas'); + $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'canvas'); + $this->configurePublishing(); + $this->configureRoutes(); + $this->configureCommands(); + $this->registerMigrations(); + $this->registerEvents(); } /** @@ -76,15 +67,34 @@ private function registerEvents() } /** - * Register the package routes. + * Configure the routes offered by the application. * * @return void */ - private function registerRoutes() + private function configureRoutes() { $this->loadRoutesFrom(__DIR__.'/Http/routes.php'); } + /** + * Configure the commands offered by the application. + * + * @return void + */ + protected function configureCommands() + { + if (! $this->app->runningInConsole()) { + return; + } + + $this->commands([ + AdminCommand::class, + DigestCommand::class, + InstallCommand::class, + PublishCommand::class, + ]); + } + /** * Register the package's migrations. * @@ -98,30 +108,32 @@ private function registerMigrations() } /** - * Register the package's publishable resources. + * Configure publishing for the package. * * @return void */ - private function registerPublishing() + private function configurePublishing() { - if ($this->app->runningInConsole()) { - $this->publishes([ - __DIR__.'/../public' => public_path('vendor/canvas'), - ], 'canvas-assets'); - - $this->publishes([ - __DIR__.'/../config/canvas.php' => config_path('canvas.php'), - ], 'canvas-config'); - - $this->publishes([ - __DIR__.'/../resources/lang' => resource_path('lang/vendor/canvas'), - ], 'canvas-lang'); - - $this->publishes([ - __DIR__.'/../resources/stubs/CanvasServiceProvider.stub' => app_path( - 'Providers/CanvasServiceProvider.php' - ), - ], 'canvas-provider'); + if (! $this->app->runningInConsole()) { + return; } + + $this->publishes([ + __DIR__.'/../public' => public_path('vendor/canvas'), + ], 'canvas-assets'); + + $this->publishes([ + __DIR__.'/../config/canvas.php' => config_path('canvas.php'), + ], 'canvas-config'); + + $this->publishes([ + __DIR__.'/../resources/lang' => resource_path('lang/vendor/canvas'), + ], 'canvas-lang'); + + $this->publishes([ + __DIR__.'/../resources/stubs/CanvasServiceProvider.stub' => app_path( + 'Providers/CanvasServiceProvider.php' + ), + ], 'canvas-provider'); } } diff --git a/yarn.lock b/yarn.lock index bd29f85c8..6d3d1c4fb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1786,9 +1786,9 @@ caniuse-api@^3.0.0: lodash.uniq "^4.5.0" caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001109, caniuse-lite@^1.0.30001111: - version "1.0.30001120" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001120.tgz#cd21d35e537214e19f7b9f4f161f7b0f2710d46c" - integrity sha512-JBP68okZs1X8D7MQTY602jxMYBmXEKOFkzTBaNSkubooMPFOAv2TXWaKle7qgHpjLDhUzA/TMT0qsNleVyXGUQ== + version "1.0.30001122" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001122.tgz#2c8ff631330d986a07a7ba7125cce77a1373b475" + integrity sha512-pxjw28CThdrqfz06nJkpAc5SXM404TXB/h5f4UJX+rrXJKE/1bu/KAILc2AY+O6cQIFtRjV9qOR2vaEp9LDGUA== chalk@^1.1.3: version "1.1.3" @@ -2721,9 +2721,9 @@ ejs@^2.6.1: integrity sha512-7vmuyh5+kuUyJKePhQfRQBhXV5Ce+RnaeeQArKu1EAMpL3WbgMt5WG6uQZpEVvYSSsxMXRKOewtDk9RaTKXRlA== electron-to-chromium@^1.3.523: - version "1.3.555" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.555.tgz#a096716ff77cf8da9a608eb628fd6927869503d2" - integrity sha512-/55x3nF2feXFZ5tdGUOr00TxnUjUgdxhrn+eCJ1FAcoAt+cKQTjQkUC5XF4frMWE1R5sjHk+JueuBalimfe5Pg== + version "1.3.556" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.556.tgz#d2a8fed6b93051c5c27d182c43c7bc4d88b77afb" + integrity sha512-g5cGpg6rOCXxyfaLCQIWz9Fx+raFfbZ6sc4QLfvvaiCERBzY6YD6rh5d12QN++bEF1Tm9osYnxP37lbN/92j4A== elliptic@^6.5.3: version "6.5.3" @@ -5643,9 +5643,9 @@ posix-character-classes@^0.1.0: integrity sha1-AerA/jta9xoqbAL+q7jB/vfgDqs= postcss-calc@^7.0.1: - version "7.0.3" - resolved "https://registry.yarnpkg.com/postcss-calc/-/postcss-calc-7.0.3.tgz#d65cca92a3c52bf27ad37a5f732e0587b74f1623" - integrity sha512-IB/EAEmZhIMEIhG7Ov4x+l47UaXOS1n2f4FBUk/aKllQhtSCxWhTzn0nJgkqN7fo/jcWySvWTSB6Syk9L+31bA== + version "7.0.4" + resolved "https://registry.yarnpkg.com/postcss-calc/-/postcss-calc-7.0.4.tgz#5e177ddb417341e6d4a193c5d9fd8ada79094f8b" + integrity sha512-0I79VRAd1UTkaHzY9w83P39YGO/M3bG7/tNLrHGEunBolfoGM0hSjrGvjoeaj0JE/zIw5GsI2KZ0UwDJqv5hjw== dependencies: postcss "^7.0.27" postcss-selector-parser "^6.0.2"