Frontend Controller Architecture
Layup now ships a proper base controller for frontend rendering. AbstractController is model-agnostic -- extend it, implement getRecord(), and return any Eloquent model that has getSectionTree() and
getContentTree(). PageController narrows this to Page for the built-in routes.
Override methods for authorization, layout, view selection, extra view data, and cache headers are all available and fully documented for IDE autocompletion.
class PageController extends AbstractController
{
protected function getRecord(Request $request): Model
{
return Page::published()
->where('slug', $request->route('slug'))
->firstOrFail();
}
}
New: layup:make-controller Command
Scaffold a frontend controller with one command:
php artisan layup:make-controller PageController
Generates a ready-to-use controller with getRecord() pre-filled and commented override method signatures. Prints next steps for routing and config.
Fingerprint-Based Widget Registry Caching
WidgetRegistry::toJs() and grouped() now cache their output keyed by a fingerprint (MD5 of registered widget types). Cache auto-invalidates when widgets are registered or unregistered -- no manual cache
clearing needed.
Frontend Loop View
New layup::frontend.loop partial extracts the section rendering loop from the page view. Reusable in custom views without duplicating the iteration logic.
Shared Widget Registration
Widget registration logic (config + auto-discovery from App\Layup\Widgets) is extracted into a RegistersWidgets trait, eliminating duplication between controllers.
Documentation
- Added Filament prerequisite reminder to installation steps
- Custom controller guide with override methods table and three examples (authorization, caching, view fallback)
- Artisan commands reference table
- View variables reference
Full Changelog
- Add AbstractController base class (model-agnostic)
- Add RegistersWidgets trait
- Add layup:make-controller artisan command
- Add fingerprint-based caching to WidgetRegistry
- Add layup::frontend.loop partial view
- Refactor PageController to extend AbstractController
- Remove AbstractPageController (unnecessary middle layer)
- Expand README with frontend rendering docs and prerequisites