Shipu / themevel

Theme and asset management for laravel
Creative Commons Zero v1.0 Universal
347 stars 67 forks source link

Using in Service Prodiver #67

Closed DuelistRag3 closed 1 year ago

DuelistRag3 commented 1 year ago

When using Theme::current() in service provider it returns an empty string. I try to use themevel together with nwidart modules package and for the modules to find the views it is necessary to add the current theme path into the Modules service provider like this:

public function registerViews()
    {
        $themePath = base_path('Themes/'.Theme::current().'/views/modules/'. $this->moduleNameLower);

        $viewPath = resource_path('views/modules/' . $this->moduleNameLower);

        $sourcePath = module_path($this->moduleName, 'Resources/views');

        echo($themePath);

        $this->publishes([
            $sourcePath => $viewPath
        ], ['views', $this->moduleNameLower . '-module-views']);

        $this->loadViewsFrom(array_merge([$themePath], $this->getPublishableViewPaths(), [$sourcePath]), $this->moduleNameLower);
    }

but $themePath return: /var/www/html/Themes//views/modules/installer

DuelistRag3 commented 1 year ago

Okay so, that was because no theme was set, but i included the facade and set the active theme in the config, but no theme is active

Shipu commented 1 year ago

Fixed in v3.0.4 version.