Skip to content

Commit

Permalink
fix: update module stub to proper view loading template. (phpvms#1920)
Browse files Browse the repository at this point in the history
  • Loading branch information
BossOfGames authored Dec 27, 2024
1 parent e29f165 commit 9316ef4
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions resources/stubs/modules/provider.stub
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,13 @@ class AppServiceProvider extends ServiceProvider
public function registerViews()
{
$viewPath = resource_path('views/modules/$LOWER_NAME$');
$sourcePath = __DIR__.'/../Resources/views';
$sourcePath = __DIR__ . '/../Resources/views';

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

$this->loadViewsFrom(array_merge(array_filter(array_map(function ($path) {
$path = str_replace('default', setting('general.theme'), $path);
// Check if the directory exists before adding it
if (file_exists($path.'/modules/$LOWER_NAME$') && is_dir($path.'/modules/$LOWER_NAME$'))
return $path.'/modules/$LOWER_NAME$';

return null;
}, \Config::get('view.paths'))), [$sourcePath]), '$LOWER_NAME$');
$this->loadViewsFrom(array_merge(array_map(function ($path) {
return str_replace('default', setting('general.theme'), $path) . '/modules/$LOWER_NAME$';
}, \Config::get('view.paths')), [$sourcePath]), '$LOWER_NAME$');
}

/**
Expand Down

0 comments on commit 9316ef4

Please sign in to comment.