Laravel SAAS 主题结构与配置和供应商

问题描述

我正在开发 Sass,其中商店所有者可以拥有自己的商店主题。我希望他们能够编辑主题上传主题。 Theme 文件夹将有 configvendor 文件夹来安装包、迁移和发布。我在想如何创建这个文件夹结构。配置 app.PHP 和 composer.json 文件不应与 composer 和 config 所在的根文件夹重复。

 Structure of Root Folder
   #acontent
   #app
   #config
   #database
   #public
   #resources
   #routes
   #storage
   #tests
   #vendor

Under Custom Diretory #acontent
 #THEMES
 --#[THEME NAME]
   --#http
   --#public
   --#routes
   --#views
   --


namespace Acontent\Theme;
use Illuminate\Support\ServiceProvider;
use Illuminate\Foundation\AliasLoader;
/**
 * 
 */
class ThemeServiceProvider extends ServiceProvider
{
    public function register()
    {
        $this->app->booting(function() {
            $loader = AliasLoader::getInstance();
            
            $files = file_get_contents( base_path().'/acontent/Themes/Helper.json');
            $helpers = json_decode($files,true);
            if (is_array($helpers) || is_object($helpers))
            {
                foreach ($helpers as $key => $value) {
                    $loader->alias($value['name'],$value['class']);
                }
            }
            
        });
    }

    public function boot()
    {
        $file = file_get_contents( base_path().'/acontent/Themes/theme.json');
        $themes = json_decode($file,true);
        foreach ($themes as $theme) {
            if ($theme['status'] == 'active') {
                $this->loadRoutesFrom(__DIR__.'/'.$theme['Text Domain'].'/routes/web.PHP');
                $this->loadMigrationsFrom(__DIR__.'/'.$theme['Text Domain'].'/migrations');
                $this->loadViewsFrom(__DIR__.'/'.$theme['Text Domain'].'/views','theme');
            }
        }
    }
}

我在主题文件夹中的作曲家文件

{
    "name": "acontent/themes","description": "themes system for acontent system","type": "library","license": "GNU","authors": [
        {
            "name": "Acontent","email": "acontent@gmail.com"
        }
    ],"minimum-stability": "dev","require": {},"autoload": {
        "psr-4": {
            "Acontent\\Theme\\": "/"
        }
    }
}

我想在服务提供者中也有配置来发布包。而且服务提供者应该对所有租户通用,只有改变上传主题名称

怎么做?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)