Access Gate: 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.
<?phpdeclare(strict_types=1);final class ExampleAccessRequestMethodImplementation implements \Capell\AccessGate\Contracts\AccessRequestMethod{ public function key(): string { throw new LogicException('Implement this package contract for the calling site.'); } public function label(): string { throw new LogicException('Implement this package contract for the calling site.'); } public function description(): ?string { throw new LogicException('Implement this package contract for the calling site.'); } public function isEnabled(\Capell\AccessGate\Models\Area $area): bool { throw new LogicException('Implement this package contract for the calling site.'); } public function isPrimary(\Capell\AccessGate\Models\Area $area): bool { throw new LogicException('Implement this package contract for the calling site.'); } public function url(\Capell\AccessGate\Models\Area $area, ?string $requestedUrl = null): string { throw new LogicException('Implement this package contract for the calling site.'); }}
app()->bind(\Capell\AccessGate\Contracts\AccessRequestMethod::class, ExampleAccessRequestMethodImplementation::class);<?phpdeclare(strict_types=1);final class ExampleAdminNotificationRecipientResolverImplementation implements \Capell\AccessGate\Contracts\AdminNotificationRecipientResolver{ /** * Resolve the recipients that should receive access gate admin notifications. * * @return Collection<int, mixed> */ public function resolve(): \Illuminate\Support\Collection { throw new LogicException('Implement this package contract for the calling site.'); }}
app()->bind(\Capell\AccessGate\Contracts\AdminNotificationRecipientResolver::class, ExampleAdminNotificationRecipientResolverImplementation::class);<?phpdeclare(strict_types=1);final class ExampleRegistrationFieldImplementation implements \Capell\AccessGate\Contracts\RegistrationField{ public function key(): string { throw new LogicException('Implement this package contract for the calling site.'); } public function label(): string { throw new LogicException('Implement this package contract for the calling site.'); } /** * @param array<string, mixed> $input */ public function validate(array $input): \Capell\AccessGate\Data\RegistrationFieldValue { throw new LogicException('Implement this package contract for the calling site.'); }}
app()->bind(\Capell\AccessGate\Contracts\RegistrationField::class, ExampleRegistrationFieldImplementation::class);<?phpdeclare(strict_types=1);$inputs = []; // Supply the arguments required by the action handle() method.resolve(\Capell\AccessGate\Actions\InstallAccessGatePackageAction::class)->handle(...$inputs);<?phpdeclare(strict_types=1);$inputs = []; // Supply the arguments required by the action handle() method.resolve(\Capell\AccessGate\Bridges\Payments\CreatePaidAccessCheckoutForRegistrationAction::class)->handle(...$inputs);<?phpdeclare(strict_types=1);\Capell\AccessGate\Manifest\PaidAccessCheckoutCreationContribution::run();Customer Portal ownership
Section titled “Customer Portal ownership”The portal feed uses the durable owner of the persisted PortalAccount. Registration
user_id, grant user_id and user subjects, and the grant’s registration owner
must agree with the configured users-provider model and its owner ID. Browser-token
metadata follows the same grant authorisation. These owned items remain visible
after an email change, including when the current address is unverified or email
reconciliation has a collision. Conflicting owner links are suppressed. Site and
global-area restrictions still apply.
Guest registrations and email-only grants without a durable user association are suppressed. Current or historical email matches never authorise them. The feed does not relink records or issue browser tokens.
Operator recovery
Section titled “Operator recovery”Independently establish ownership of the specific registration or grant from the original request or access evidence and an authenticated customer identity. Current control of the email address is insufficient. Record the evidence and operator in your support case; keep personal evidence out of application logs.
Run in the owning installed application’s Artisan environment:
php artisan capell-access-gate:link-legacy-record registration 123 456php artisan capell-access-gate:link-legacy-record registration 123 456 --confirmphp artisan capell-access-gate:link-legacy-record grant 789 456 --confirmtype is registration or grant; id is that record’s ID. userOrOwner is the
numeric ID of the independently verified customer in auth.providers.users.model.
It is never an email or an arbitrary model’s coincidentally equal numeric ID. The
configured model must be authenticatable and the user must exist. A portal owner
must use that same configured model for these Access Gate records to be visible.
Without --confirm, the command validates and prints the proposed link but writes
nothing. With it, the command sets only a null user_id. It refuses records already
owned, user-subject grants, and durable associations on a related registration or
its grants, including associations to the same owner. It never overwrites or resolves
conflicting ownership. Linking a legacy registration also makes its otherwise
unowned grants and browser-token metadata visible through the existing registration
link. Linking a standalone grant leaves unrelated registrations unchanged.
Confirmed links emit capell-access-gate.legacy-record-owner-linked to the application
log with record type/ID and canonical user type/ID. Dry runs and refusals produce no
successful-link audit line. Check the correct site’s portal feed after linking;
existing site/global-area restrictions still apply. Resolve records with existing
or conflicting associations separately, using their original evidence.