diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 63295f25..5e80806e 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -3,6 +3,7 @@ namespace App\Exceptions; use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; +use Illuminate\Support\Facades\Log; use Inertia\Inertia; use Throwable; diff --git a/app/Maintenance/EnvMaintenanceMode.php b/app/Maintenance/EnvMaintenanceMode.php new file mode 100644 index 00000000..56d37067 --- /dev/null +++ b/app/Maintenance/EnvMaintenanceMode.php @@ -0,0 +1,48 @@ +app->environment(['maintenance']); + } + + /** + * Get the data array which was provided when the application was placed into maintenance. + * + * @return array + */ + public function data(): array { + return []; + } +} diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 9ff88320..3b870211 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -2,6 +2,10 @@ namespace App\Providers; +use App\Maintenance\EnvMaintenanceMode; +use Illuminate\Contracts\Container\Container; +use Illuminate\Contracts\Foundation\Application; +use Illuminate\Foundation\MaintenanceModeManager; use Illuminate\Support\Facades\URL; use Illuminate\Support\ServiceProvider; @@ -12,7 +16,18 @@ class AppServiceProvider extends ServiceProvider */ public function register(): void { - // + $this->app->extend( + MaintenanceModeManager::class, + function (MaintenanceModeManager $manager) { + $manager->extend('env', function (Container $container) { + return new EnvMaintenanceMode( + $container->make(Application::class) + ); + }); + + return $manager; + } + ); } /** diff --git a/docker-compose.yml b/docker-compose.yml index 28da5099..2275e9b6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -33,7 +33,7 @@ services: dockerfile: ./dockerfiles/Dockerfile.website target: deploy args: - - LARAVEL_ENV=local + - LARAVEL_ENV=${APP_ENV:-local} - LARAVEL_ENV_FILE=.env ports: - '80:80'