From 1d56e0d45238f76894f69300d015cd5f61d0c1f6 Mon Sep 17 00:00:00 2001 From: Leon Szkliniarz Date: Mon, 12 May 2025 15:42:55 +0100 Subject: [PATCH] Made it possible to publish and edit routes. web.php and cp.php are published to routes/vendor/alt-google-2fa/ and the extension will load these instead of its routes/ files. --- src/ServiceProvider.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/ServiceProvider.php b/src/ServiceProvider.php index c735d65..799a8a1 100644 --- a/src/ServiceProvider.php +++ b/src/ServiceProvider.php @@ -55,6 +55,24 @@ public function boot() $this->publishes([ __DIR__ . '/../database/migrations/' => database_path('migrations'), ], 'alt-google-2fa-migrations'); + + $this->publishes([ + __DIR__ . '/../routes/cp.php' => base_path('routes/vendor/alt-google-2fa/cp.php'), + __DIR__ . '/../routes/web.php' => base_path('routes/vendor/alt-google-2fa/web.php'), + ], 'alt-google-2fa-routes'); + } + + protected function bootRoutes() + { + $cpPath = base_path('routes/vendor/alt-google-2fa/cp.php'); + $webPath = base_path('routes/vendor/alt-google-2fa/web.php'); + if (file_exists($cpPath)) { + $this->routes['cp'] = $cpPath; + } + if (file_exists($webPath)) { + $this->routes['web'] = $webPath; + } + return parent::bootRoutes(); } }