Skip to content

Commit

Permalink
Famous bad ideas
Browse files Browse the repository at this point in the history
  • Loading branch information
afonic committed Jan 24, 2024
1 parent 3932040 commit 7b39711
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 26 deletions.
File renamed without changes.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 [
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Middleware/HandleLocaleRedirection.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
24 changes: 0 additions & 24 deletions src/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Reach\LocaleLander\Http\Middleware\HandleLocaleRedirection;
use Statamic\Providers\AddonServiceProvider;
use Statamic\Statamic;

class ServiceProvider extends AddonServiceProvider
{
Expand All @@ -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;
}
}

0 comments on commit 7b39711

Please sign in to comment.