Support the ongoing development of Laravel.io →
Packages Architecture
Last updated 1 year ago.
0

you can create the workbench for manage multiple app.

Last updated 1 year ago.
0

grindmodeon said:

I personally put them in sub-folders. So I would have the following:

app/controllers/User/DashboardController.php

class UserDashboardController extends Controller {

   public function index() {
       return View::make('user.index');
   }

}

app/controllers/Admin/DashboardController.php

class AdminDashboardController extends Controller {

   public function index() {
       return View::make('admin.index');
   }

}

And so on.. Then your routes.php would look like:

Route::get('users/dashboard', 'UserDashboardController@index');
Route::get('admin/dashboard', 'AdminDashboardController@index');

A TIP: When doing this, you may need to run composer dump-autoload for Laravel routes to load your controllers when putting them into sub-folders.

Hopefully that helps or gets you going in the right direction.

Last updated 1 year ago.
0

Thanks, I was considering the same approach. Do you think it is a good idea to use namespaces for controllers, so that they are loaded automatically without the need for composer dump-autoload?

Last updated 1 year ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

parrker parrker Joined 14 Aug 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.