mb4it / moonshine-pages
MoonShine pages and menu package
1.0.2
2026-03-30 13:28 UTC
Requires
- php: ^8.2
- illuminate/contracts: ^12.0
- illuminate/database: ^12.0
- illuminate/http: ^12.0
- illuminate/support: ^12.0
- moonshine/ckeditor: ^3.0
- moonshine/moonshine: ^4.8
This package is auto-updated.
Last update: 2026-04-01 07:01:46 UTC
README
MoonShine package for managing pages and navigation menus in Laravel applications.
Features
- MoonShine resources for:
- Pages
- Menu positions
- Menu items
- Public page route with configurable prefix (
/{slug}or/landings/{slug}) - Configurable model and controller classes
- Route source support with dynamic route parameters (
route_paramsJSON) - Helper
menu($code)for menu tree rendering - Package view fallback for page rendering
Requirements
- PHP 8.2+
- Laravel 12+
- moonshine/moonshine 4.8+
Installation
composer require mb4it/moonshine-pages
Publish config, migrations, and views (optional):
php artisan vendor:publish --tag=moonshine-pages-config php artisan vendor:publish --tag=moonshine-pages-migrations php artisan vendor:publish --tag=moonshine-pages-views
Or publish all package assets in one command:
php artisan vendor:publish --provider="MB\MoonShine\MoonshinePagesServiceProvider"
Run migrations:
php artisan migrate
Configuration
Main config file: config/moonshine-pages.php
Important options
register_page_route- register package route automaticallyroute.route_prefix- route prefix for pages (''orlandings)route.name- route name used for page URLsmodels.page,models.menu,models.menu_position- model overridescontrollers.page_show- page show controller overridemoonshine.register_menu_items- auto-register package menu in MoonShine
Route prefix example
'route' => [ 'route_prefix' => 'landings', 'name' => 'page.show', 'slug_pattern' => '^[A-Za-z0-9-_]+$', ],
Resulting path: /landings/{slug}.
Route source parameters
When menu item source_type = route, the form:
- Shows only named GET routes.
- Detects placeholders in selected route URI (e.g.
{slug},{id}). - Shows dynamic text fields for each placeholder.
- Saves values into
menus.route_params(JSON).
Example route_params payload:
{
"slug": "my-article",
"id": "42"
}
URL generation:
- Uses
route($source_value, $route_params). - Falls back to
#if route cannot be generated.
Localization
Package localization files:
lang/en/moonshine-pages.phplang/ru/moonshine-pages.php
All package UI strings are loaded from these translation files.