Skip to content

Commit

Permalink
Adding functionality to support pages
Browse files Browse the repository at this point in the history
  • Loading branch information
tnylea committed Apr 10, 2024
1 parent 283c8d1 commit 7fdb0a5
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/ThemesServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
use Illuminate\Support\ServiceProvider;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Blade;
use Laravel\Folio\Folio;
use Illuminate\Support\Facades\File;

class ThemesServiceProvider extends ServiceProvider
{
Expand Down Expand Up @@ -86,6 +88,7 @@ public function boot()

$this->loadDynamicMiddleware($this->themes_folder, $theme);
$this->registerThemeComponents($theme);
$this->registerThemeFolioDirectory($theme);

// Make sure we have an active theme
if (isset($theme)) {
Expand Down Expand Up @@ -117,7 +120,18 @@ public function addThemeRoutes($router)
}

private function registerThemeComponents($theme){
Blade::anonymousComponentPath(resource_path('views/themes/anchor/components'));
Blade::anonymousComponentPath(resource_path('views/themes/' . $theme->folder . '/components/elements'));
Blade::anonymousComponentPath(resource_path('views/themes/' . $theme->folder . '/components'));
}

private function registerThemeFolioDirectory($theme){
if (File::exists(resource_path('views/themes/' . $theme->folder . '/pages'))) {
Folio::path(resource_path('views/themes/' . $theme->folder . '/pages'))->middleware([
'*' => [
//
],
]);
}
}

/**
Expand Down

0 comments on commit 7fdb0a5

Please sign in to comment.