Reputation: 301
I'm new to Laravel.
I'm working on a project which involves a public facing website and back-office application. Both are web applications and suppose to be hosted on different domains.
The reason for keeping these two apps separately is so that on the public facing website we don't push unnecessary code and keep it lean and clean. However, both of them are using the same database so I want to create a module/app/plugin (Not sure how to name it in Laravel) which can be shared among both applications for database models or any other business logic which can be shared between both apps.
Any idea how to achieve that with laravel framework?
Upvotes: 4
Views: 3832
Reputation: 136
Based on my experience, the most obvious approach would be to have one backend (API) used by the two frontends.
It's somehow a microservice architecture. There is a lot of pros and cons for it, but considering you don't want to push unnecessary code, spreading into different apps seems like appropriate.
If you want to keep one code base, I would consider having a load balancer (like HaProxy or Nginx) in front of your Laravel app to handle requests from configured domains to appropriate routes. For example :
acme.com
root would be /
for Laravelbo.acme.com
root would be /admin
for LaravelUpvotes: 2