Laravel Programming: To Move Controller-Model Files From Controller-Models Subfolder


Moving Controllers Files to sub-folders follow correct way

Class App\Http\Controllers\Students\StudentsController does not exist

Find out app\Http\ routes.php:

Directory folders:

Command Artisan for Create Controller :

Coding for StudentsController.php Controller

Follow Some Simple Steps to Fixed Controller Not Found

1. Put the Controller folder name in the namespace

2. Add “use App\Http\Controllers\Controller;” to the controller before the class definition

Configured Route.php for Display Website Pages:

Put the appended Controller folder name into route directory

I used the following on route.

also i check it create the admin folder. i try the group after creating the controller but it does not work for me
To used subpage into Student Page then follow prefex:
Page Directory Define:

No need to run “composer dump-autoload”

Working on Model Called App Subfolder Directory:

Create a folder (Example- app/Models),  follow couple of steps to move model file called models:

  1. For Laravel 5.1.x style

Use PSR4

Like as –

  • namespace all your model files with napespace App\Models;
  • Access models anywhere with their full namespace,


2) Laravel 4 style :

  • Load Model with composer autoloader. In composer.json add:


  • To change tha nampspace of User model you have to update config\auth.php
  • For example: use App\Models\User;

Upgrade laravel 4.x version to Laravel  5.x