I’m working on a content management system using Laravel and need help with organizing my application structure. Previously I worked with CodeIgniter where I could easily separate admin and public areas.
In my old CodeIgniter projects, I created base controllers like BackendController and PublicController, then extended them:
Post extends BackendController
Post extends PublicController
My directory structure was organized like this:
controllers
--backend
---users
---posts
---pages
--users
--posts
--pages
The admin controllers went into a separate backend folder while public controllers stayed in the main directory. What’s the recommended approach for achieving similar organization in Laravel? Should I follow the same pattern or are there better Laravel-specific methods for handling admin and frontend separation?
i keep it simple too. just make separate folders for admin and public in Controllers. like Admin/PostController for admin and PostController for public. using route groups with prefixes works good to keep it clean too without making it too complicated.
interesting question! are you using the same models for admin and public sections, or keeping those separate too? also, have you thought about using middleware for access control instead of base controllers?
Laravel handles this really well with a few different approaches. The easiest way is creating dedicated controller namespaces in your app/Http/Controllers directory. Just set up an Admin namespace next to your regular controllers. Group your routes with Route::prefix() and Route::namespace() to keep everything clean. Laravel’s middleware gives you solid access control without needing base controller inheritance. I’ve found that route model binding plus policy classes beats traditional base controller setups for authorization. The service container also lets you use dependency injection, which makes testing and maintenance way easier than the CodeIgniter setup you mentioned.