Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Laravel Controller Subfolder routing

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 2.25k
    Comment on it

    Before I have written blog how to add sub-folder in our controller but not mention that how we will do Controller sub-folder routing.As we all know that routing plays an important role in any project. In Laravel 4.x sub-folder routing can be done in following way.

    Example:To try and keep my app organized I would like to put my controllers into sub-folders of the controller folder.

    controllers\
    ---- folder1
    ---- folder2
    

    I tried to route to a controller, but laravel doesn't find it. That is the query and the solution is:

    Step 1:

    Add your controllers in your folders:

    controllers\
    ---- folder1
    ---- folder2
    

    Step 2:

    Create your route not specifying the folder:

    Route::get('/product/dashboard', 'MakeDashboardController@showDashboard');
    

    Step 3: Run the following command

    composer dump-autoload
    

    By this way we can do controller sub-folder routing.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: