How to structure a platform with sub apps in Laravel 4?

前端 未结 2 1134
闹比i
闹比i 2021-02-10 20:09

I need to develop several websites with common features and flows, the only thing that will dramatically change is the CSS, even the HTML will be common.

I\'m having tro

2条回答
  •  天涯浪人
    2021-02-10 21:01

    Assuming that the separate Git repos is required, one approach could be to have an "app" folder for each project plus one for the main project. I.e.:

    • App
    • Subapp1
    • Subapp2
    • ...

    Then you need to add an autoloader that checks if the given file is present in the subapp-folder. If not, then load from the app folder. This way you can centralize app files, but also create custom other files, or override app files via the subapp-folders. Each subapp folder can then be an individual Git repo, while the root folder excluding the subapp folders are the main repo.

    Config and routing would be handled via the main app.

    You could also add namespaces or a similar folder end structure to control in more detail what functionality is customized by the subapps, without having to override an entire controller or model from the app.

提交回复
热议问题