From 7b39711a33adc53cf77b1f48067235d2b923b39d Mon Sep 17 00:00:00 2001 From: Iosif Chatzimichail Date: Wed, 24 Jan 2024 21:32:42 +0200 Subject: [PATCH] Famous bad ideas --- LICENSE => LICENSE.md | 0 README.md | 10 +++++++- .../Middleware/HandleLocaleRedirection.php | 2 +- src/ServiceProvider.php | 24 ------------------- 4 files changed, 10 insertions(+), 26 deletions(-) rename LICENSE => LICENSE.md (100%) diff --git a/LICENSE b/LICENSE.md similarity index 100% rename from LICENSE rename to LICENSE.md diff --git a/README.md b/README.md index 12dd97a..9efc32e 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,15 @@ Install using composer: composer require reachweb/locale-lander ``` -By default, the addon is disabled to prevent any unintended breakage. Enable it in the configuration file located at config/statamic/locale-lander.php: +By default, the addon is disabled to prevent any unintended breakage. + +To enable it, publish the config file: + +``` bash +php artisan vendor:publish --tag locale-lander-config +``` + +and set enable to `true`: ```php return [ diff --git a/src/Http/Middleware/HandleLocaleRedirection.php b/src/Http/Middleware/HandleLocaleRedirection.php index 6855cd8..7faf99f 100644 --- a/src/Http/Middleware/HandleLocaleRedirection.php +++ b/src/Http/Middleware/HandleLocaleRedirection.php @@ -14,7 +14,7 @@ class HandleLocaleRedirection public function handle(Request $request, Closure $next) { // Skip if disabled - if (config('statamic.locale-lander.enable') === false) { + if (config('locale-lander.enable') === false) { return $next($request); } diff --git a/src/ServiceProvider.php b/src/ServiceProvider.php index fd5c6c5..6e18c08 100644 --- a/src/ServiceProvider.php +++ b/src/ServiceProvider.php @@ -4,7 +4,6 @@ use Reach\LocaleLander\Http\Middleware\HandleLocaleRedirection; use Statamic\Providers\AddonServiceProvider; -use Statamic\Statamic; class ServiceProvider extends AddonServiceProvider { @@ -13,27 +12,4 @@ class ServiceProvider extends AddonServiceProvider HandleLocaleRedirection::class, ], ]; - - public function bootAddon() - { - $this->mergeConfigFrom(__DIR__.'/../config/locale-lander.php', 'statamic.locale-lander'); - - if ($this->app->runningInConsole()) { - $this->publishes([ - __DIR__.'/../config/locale-lander.php' => config_path('statamic/locale-lander.php'), - ], 'locale-lander'); - } - } - - protected function bootPublishAfterInstall() - { - Statamic::afterInstalled(function ($command) { - $command->call('vendor:publish', [ - '--tag' => $this->getAddon()->slug(), - '--force' => true, - ]); - }); - - return $this; - } }