From c1c787d3d7b6fbab4b922c520a48c937fcf915e6 Mon Sep 17 00:00:00 2001 From: freek Date: Thu, 20 Jan 2022 16:19:53 +0100 Subject: [PATCH] do not discover any controllers by default --- config/route-discovery.php | 2 +- .../getting-started.md | 11 ++++++++--- docs/installation-setup.md | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/config/route-discovery.php b/config/route-discovery.php index d68be79..8da18cb 100644 --- a/config/route-discovery.php +++ b/config/route-discovery.php @@ -6,7 +6,7 @@ * these directories. */ 'discover_controllers_in_directory' => [ - app_path('Http/Controllers'), + // app_path('Http/Controllers'), ], /* diff --git a/docs/discovering-routes-for-controllers/getting-started.md b/docs/discovering-routes-for-controllers/getting-started.md index 03841f1..f26ac7a 100644 --- a/docs/discovering-routes-for-controllers/getting-started.md +++ b/docs/discovering-routes-for-controllers/getting-started.md @@ -7,9 +7,15 @@ This package can automatically discover and register routes for a directory cont ## Via the config file +First, you need to publish the config file. This will create a file at `config/route-discovery.php` + +```bash +php artisan vendor:publish --tag="route-discovery-config" +``` + In the `discover_controllers_in_directory` key of the `route-discovery` config file, you can specify a directory that contains controllers. -By default, all controllers in the `app_path('Http/Controllers')` will be registered. +Here you can uncomment the line to register controllers in the `app_path('Http/Controllers')` directory. Of course you can use any directory you want. ```php // config/route-discovery @@ -21,13 +27,12 @@ By default, all controllers in the `app_path('Http/Controllers')` will be regist 'discover_controllers_in_directory' => [ app_path('Http/Controllers'), ], - // ... ``` ## Via the routes file -You can also enable route discovery via the routes file. If you want to go this... route 🥁, first remove all entries in the `discover_controllers_in_directory` key of the `route-discovery` config file. +You can also enable route discovery via the routes file. ```php // in a routes file diff --git a/docs/installation-setup.md b/docs/installation-setup.md index e043909..941da63 100644 --- a/docs/installation-setup.md +++ b/docs/installation-setup.md @@ -26,7 +26,7 @@ return [ * these directories. */ 'discover_controllers_in_directory' => [ - app_path('Http/Controllers'), + // app_path('Http/Controllers'), ], /*