D
D
DocTypeMaster2021-09-18 13:31:44
Laravel
DocTypeMaster, 2021-09-18 13:31:44

How to separate admin panel and main site into different projects in laravel?

Friends, I started to make an admin panel for the site, and I want to make it on a separate Laravel project, tell me how to do it right and is it advisable to do it at all?

For now, this will all be on the same server, both the admin panel and the application, but in the future, for security, I will spread it to different servers. In general, how can I do this better, on the admin.domain.com subdomain, or do it in some other way *?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
P
pLavrenov, 2021-09-18
@pLavrenov

If you really want to separate the repositories, then you can use modularity.
With such a desire, in general, it seems to me that it makes no sense to put the site on laravel, as there are easier ways with less labor.
nWidart/laravel-modules

P
Peter Slobodyanyuk, 2021-09-20
@PeterLS

I think that when solving such problems, the easiest way is to describe all the pros and cons and make a decision:
+ load distribution
+ in a sense, a higher level of security, but this is a moot point
+ independent (in a sense) development
- 2 times more code (libraries, services, policies, models and much more is duplicated)
- technical support
is more difficult - the chance of database corruption increases
- independent development
Personally, my opinion is that it is not advisable to split it into 2 separate projects. On a separate domain (subdomain) - perhaps. This is done in order to distribute the load on PHP. This is done by setting the prefix for the routes. But you need to do this, again, if you really need to. It’s hard to judge here without knowing what kind of resource you have and how many hours of development are included in it.

E
Evgeniy S, 2021-09-22
@evgensenin

Hey!
with a subdomain the idea is sound! Moreover, Laravel routing allows you to put all your admin routes on a subdomain.
I see sharing on repositories only if you are going to share access to the code to other programmers. otherwise, many problems will arise, from storage to deployment. Or if the admin panel is not written in Lara (for example, in Vue or React). but again, it's better to do git-modules or package lara.
Also, for security, you will most likely create a non-standard subdomain - such as adminka367sd.domain.com, + so that the admin cookies have different names and do not overlap with the working site.
and more - the database will be common, for the working site and for the admin panel. and if on different servers, then there will be database access lags. Architecture needs to be considered

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question