Skip to content

Worked extension examples

These developer-facing recipes are kept beside the package contract. Replace the example values with the site-specific records and data objects used by the calling workflow.

<?php
declare(strict_types=1);
final class ExampleEditableRegionApprovalWorkflowImplementation implements \Capell\FrontendAuthoring\Contracts\EditableRegionApprovalWorkflow
{
public function supports(\Illuminate\Database\Eloquent\Model $record): bool
{
throw new LogicException('Implement this package contract for the calling site.');
}
/**
* @param Closure(Model): void $applyValue
*/
public function saveForApproval(\Illuminate\Database\Eloquent\Model $record, \Illuminate\Contracts\Auth\Authenticatable $actor, string $currentUrl, \Closure $applyValue): string
{
throw new LogicException('Implement this package contract for the calling site.');
}
}
app()->bind(\Capell\FrontendAuthoring\Contracts\EditableRegionApprovalWorkflow::class, ExampleEditableRegionApprovalWorkflowImplementation::class);
<?php
declare(strict_types=1);
final class ExampleEditableRegionEditorSurfaceImplementation implements \Capell\FrontendAuthoring\Contracts\EditableRegionEditorSurface
{
public function surface(): \Capell\FrontendAuthoring\Enums\EditableRegionSurface
{
throw new LogicException('Implement this package contract for the calling site.');
}
public function render(\Capell\FrontendAuthoring\Data\EditableRegionPayloadData $payload, \Illuminate\Contracts\Auth\Authenticatable $user): \Illuminate\Contracts\View\View
{
throw new LogicException('Implement this package contract for the calling site.');
}
}
app()->bind(\Capell\FrontendAuthoring\Contracts\EditableRegionEditorSurface::class, ExampleEditableRegionEditorSurfaceImplementation::class);