diff --git a/config/layup.php b/config/layup.php index 566d14e..60b904f 100644 --- a/config/layup.php +++ b/config/layup.php @@ -160,6 +160,7 @@ 'pages' => [ 'table' => 'layup_pages', 'model' => \Crumbls\Layup\Models\Page::class, + 'enabled' => true, 'default_slug' => null, /* diff --git a/docs/configuration.md b/docs/configuration.md index 8e5ae4b..4bc7000 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -50,12 +50,14 @@ The filesystem disk used for media uploads (images, files). Must be publicly acc 'pages' => [ 'table' => 'layup_pages', 'model' => \Crumbls\Layup\Models\Page::class, + 'enabled' => true, 'default_slug' => null, ], ``` - **table** -- database table name for pages. Change this if you need multiple Layup instances with separate tables. - **model** -- the Eloquent model class. Extend `Page` and point here to add custom behavior. +- **enabled** -- whether the Pages resource is registered in the Filament admin panel. Set to `false` when you're using Layup purely as a rendering engine (e.g. attaching `HasLayupContent` to your own models and managing content through your own Filament resources). Disabling the resource does not affect frontend rendering or the database -- it only removes the admin UI. Pages already in the database still render normally via the frontend controller or `@layup` directive. - **default_slug** -- if set, this slug is served when the frontend prefix is hit without a slug. ## Revisions diff --git a/src/LayupPlugin.php b/src/LayupPlugin.php index b7050af..ed195a6 100644 --- a/src/LayupPlugin.php +++ b/src/LayupPlugin.php @@ -143,9 +143,11 @@ public function withoutPanelColors(): static public function register(Panel $panel): void { - $panel->resources([ - PageResource::class, - ]); + if (config('layup.pages.enabled', true)) { + $panel->resources([ + PageResource::class, + ]); + } } public function boot(Panel $panel): void