younus's avatar

Product design style - Yes/No

How to design a product with an admin panel and a user panel? Both these user types have completely different set of views and behaviors. They share data though. The admin can perform operations based on the user's data which is persisted to a database. Now the design confusion. Is having 2 different Laravel applications with a common database good design? or Having user types in the user model, a better design?

0 likes
6 replies
martinbean's avatar

@younus You don’t need two different Laravel applications. Just have two sets of controllers and views, one set for the front-end and one set for the back-end.

1 like
jekinney's avatar

As @martinbean stated.

Depending on the scope in my controller folder I add two folders: Backend and Frontend obviously each holds appropriate controllers.

Under view folder I due the same but lowercase. Each has it's own theme folder etc. Any shared partials or views (think error pages or flash message partials) go directly under view folder.

But on a small app it may not be necessary to separate everything. Just have two themes if you. A main or whatever and an admin to extend.

1 like
Francismori7's avatar

Make a back-end API (REST controllers), and then use Angular front-ends for admins and users, make Ajax calls to the resources (you got your data), and design accordingly.

ionutbajescu's avatar
Level 1

I had once used a separate namespace for the entire Admin logic. (that being the middlewares, the controllers, routes, views and so on).

That worked pretty well. And if you think that the admin will be enough big for that, then it can certainly be a good design choice.

On the simpler applications, I just had an admin folder in the views directory and an Admin namespace in the controllers one. Basically, the controllers were similar to this:

  • User/
  • Admin/
  • Api/
  • AbstractController.php
younus's avatar

@Francismori7 I think the complexity of implementing a REST server and Angular client is higher compared to developing a typical MVC Laravel application. If you've developed such application, what are the efficiency benefits you achieved.

Francismori7's avatar

@younus It is easily scalable to using numerous other languages - you work with HTTP requests. You can implement let's say a windows phone app is less than 2 hours having the REST API available. You just defer your logic to it, it is still part of your Laravel project, just namespaced differently.

Please or to participate in this conversation.