-
-
Notifications
You must be signed in to change notification settings - Fork 12
Description
Support both swapping out which page model to use, and decorating existing ones. Can be done in a minor v2 release
Would be cool to be able to extend/decorate page models. For example, want to customize a bunch of stuff for MarkdownPages, maybe provide your own MakdownPage class extending the main one?
Maybe something like in Laravel?
The extend method allows the modification of resolved services. For example, when a service is resolved, you may run additional code to decorate or configure the service. The extend method accepts two arguments, the service class you're extending and a closure that should return the modified service. The closure receives the service being resolved and the container instance:
$this->app->extend(Service::class, function (Service $service, Application $app) {
return new DecoratedService($service);
});
Originally posted by @caendesilva in #1499