First, create an admin folder in the controllers folder.
Method 1: directly create a controller in the background. For example, we can normally write our contents in admincontroller. php.
In the routing table,
Route: Get ('admin', '[email protected]');
We found that the Program reported an error, saying that the controller admincontroller could not be found.
Open the command line tool and go to the directory where the project is located, that is, artisan and composer. JSON,
Run the command composer dumpautoload or composer dump-autoload.
This is to optimize automatic loading.
After running the command, go to the composer directory in the vendor directory,
Let's take a look at our autoload_classmap.php file and find that there is an additional admincontroller record.
By the way, refresh the browser to see the content of the background controller.
However, this disadvantage is that you must run this command every time you add a new controller ..
Laravel how to add subfolders and controllers to Controllers