Laravel-一个CMS/多个站点 [英] Laravel - One CMS / multiple sites

查看:70
本文介绍了Laravel-一个CMS/多个站点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用laravel开发了一个CMS,希望将其用于多个网站.我的目标是在一个单一的地方进一步开发我的CMS,并且在较旧的网站中没有旧的"CMS代码".

I developed a CMS with laravel which I want to use for multiple websites. My goal is to have a single place to develop my CMS further and don't have old "CMS code" in older websites.

问题是我不知道如何构造laravel文件夹结构.这就是我的想法:

The problem is that I dont know how to structure my laravel folder structure. This is what I have in mind:

  • -厘米
    • -website-1
    • -website-2
    • -website-3

    每个网站必须拥有自己的网站-公用文件夹-.env文件(或数据库和其他网站特定设置的配置)-路线-资源(视图,资产)-控制器-lang文件-等等

    each website must have it's own - public folder - .env file (or config for database and other website specific settings) - routes - resources(views, assets) - controller('s) - lang files - etc.

    在开发中,我想使用网站的域(website-1.test)作为指示,应使用哪个网站文件夹.

    In development I want to use the website's domain(website-1.test) as indicator what website folder should be used.

    我使用伪造来部署我的网站.我的想法是为CMS建立一个git储存库,为每个网站建立一个git储存库.在网站存储库中,我仅推送网站文件夹.在CMS资源库中,整个项目已保存,但所有网站文件夹均被.gitignored.

    I use forge to deploy my websites. My idea is to have a git repository for the CMS and a git repository for each of the websites. In the websites repositories I only push the website folder. In the CMS repository the whole project is saved but all the website folders are .gitignored.

    因此对于生产服务器,我要牢记以下文件夹结构:

    So for the production server i had this folder structure in mind:

    • CMS(git存储库)
      • 网站(git repo)

      更新网站的正面时,我会推送网站存储库,如果要更新CMS,我会推送CMS存储库.

      When updating the front of a website I push the website repo, if I want to update the CMS I push the CMS repo.

      请记住,这是我的第一个想法,我知道我的想法可能根本无法实现.我正在寻找适合自己情况的建议.如果可以通过其他方法或更好的方法来实现,那么我很乐意收到有关此方面的建议.

      Bare in mind that these are my first thoughts and I am aware that my ideas might not be possible at all. I'm looking for advice and suggestions for my situation. If it can be achieved in another way or a better way I'd be glad to receive advice on that.

      提前谢谢!

      推荐答案

      对于如何实现潜在的要求,我有两个初步想法:

      I have two initial ideas of how what you are asking for potentially could be achieved:

      • API

      通过在CMS中通过CMS创建一个后端来创建后端,您可以为各个站点创建多个API.然后为每个调用相应API的站点做一个前端仓库.

      Make one repo for backend creation through CMS in witch you can create multiple APIs for various sites. Then make a front-end repo for each site that calls the corresponding API.

      https://laravel.com/docs/5.8/eloquent-resources

      包装

      您可以为您的cms代码制作一个composer程序包,然后将该程序包拖入您的每个网站项目中

      You could make a composer package for your cms code and then pull that package in to each of your website project

      https://blog.jgrossi.com/2013/creating-your-first-composer-packagist-package/

      这篇关于Laravel-一个CMS/多个站点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆