FIX: fix registering template paths
This commit is contained in:
@@ -45,28 +45,30 @@ class TemplateServiceProvider extends ServiceProvider
|
||||
|
||||
public function registerTemplatePaths($publicTemplates)
|
||||
{
|
||||
$modules = Module::all()
|
||||
->pluck('id', 'alias');
|
||||
$modules = Module::where('enabled', true)
|
||||
->get()
|
||||
->pluck('id', 'alias')
|
||||
->toArray();
|
||||
|
||||
/**
|
||||
* @var $registrator TemplateRegistrator
|
||||
*/
|
||||
$registrator = $this->app->make('registerTemplateDir');
|
||||
|
||||
foreach ($publicTemplates as $template) {
|
||||
// setup some global variables
|
||||
$module = strtolower($template['module']);
|
||||
$alias = isset($template['alias']) ? $template['alias'] : $module;
|
||||
$namespace = isset($template['namespace']) ? $template['namespace'] : strtolower($template['module']);
|
||||
|
||||
if (!$modules->get($alias)) {
|
||||
if (!isset($modules[$alias])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// register path with current template name
|
||||
|
||||
$registrator->setNamespace($namespace);
|
||||
$registrator->setModuleId($modules->get($alias));
|
||||
$registrator->register('resources/views/modules/' . $module, 'visitor', $template['templateName']);
|
||||
$registrator->setModuleId($modules[$alias]);
|
||||
$registrator->register('resources/views/modules/' . $alias, 'visitor', $template['templateName']);
|
||||
}
|
||||
|
||||
// register also global resources/views/visitor directory
|
||||
|
||||
Reference in New Issue
Block a user