Skip to content

Extension and action examples

Use the action functions with records and Data objects supplied by your application. They pass each argument to the package operation and return its result.

These adapters show container registration. Use the owning package registry when a contract requires contributor discovery.

Contract adapters wrap an existing implementation. Call their registration function from your service provider with that implementation; tagged contracts keep their declared tag. Resolve the backend by its concrete class before registration so the replacement contract does not resolve itself. Static contract metadata uses one backend class per adapter.

<?php
declare(strict_types=1);
namespace App\CapellExamples\PrivacyCenter;
function runAnonymizePrivacySubject(\Illuminate\Database\Eloquent\Model $subject): int
{
return \Capell\PrivacyCenter\Actions\AnonymizePrivacySubjectAction::run($subject);
}
<?php
declare(strict_types=1);
namespace App\CapellExamples\PrivacyCenter;
function runApplyRetentionRule(\Capell\PrivacyCenter\Models\RetentionRule $rule, ?\Carbon\CarbonInterface $now = null, bool $dryRun = false): \Capell\PrivacyCenter\Data\RetentionExecutionResultData
{
return \Capell\PrivacyCenter\Actions\ApplyRetentionRuleAction::run($rule, $now, $dryRun);
}
<?php
declare(strict_types=1);
namespace App\CapellExamples\PrivacyCenter;
function runApplyRetentionRules(?\Carbon\CarbonInterface $now = null): \Illuminate\Support\Collection
{
return \Capell\PrivacyCenter\Actions\ApplyRetentionRulesAction::run($now);
}
<?php
declare(strict_types=1);
namespace App\CapellExamples\PrivacyCenter;
function runBuildPrivacyCenterOverviewStats(): array
{
return \Capell\PrivacyCenter\Actions\BuildPrivacyCenterOverviewStatsAction::run();
}
<?php
declare(strict_types=1);
namespace App\CapellExamples\PrivacyCenter;
function runBuildPrivacyExport(\Illuminate\Database\Eloquent\Model $subject): \Capell\PrivacyCenter\Data\PrivacyExportData
{
return \Capell\PrivacyCenter\Actions\BuildPrivacyExportAction::run($subject);
}
<?php
declare(strict_types=1);
namespace App\CapellExamples\PrivacyCenter;
function runCreateRetentionRule(\Capell\PrivacyCenter\Data\RetentionRuleData $ruleData): \Capell\PrivacyCenter\Models\RetentionRule
{
return \Capell\PrivacyCenter\Actions\CreateRetentionRuleAction::run($ruleData);
}
<?php
declare(strict_types=1);
namespace App\CapellExamples\PrivacyCenter;
function runMarkPrivacyRequestFulfilled(\Capell\PrivacyCenter\Models\PrivacyRequest $privacyRequest, array $workflowPayload = [], ?\Carbon\CarbonInterface $fulfilledAt = null): \Capell\PrivacyCenter\Models\PrivacyRequest
{
return \Capell\PrivacyCenter\Actions\MarkPrivacyRequestFulfilledAction::run($privacyRequest, $workflowPayload, $fulfilledAt);
}
<?php
declare(strict_types=1);
namespace App\CapellExamples\PrivacyCenter;
function runOpenPrivacyRequest(\Capell\PrivacyCenter\Data\PrivacyRequestData $requestData, ?\Illuminate\Database\Eloquent\Model $requester = null, ?\Illuminate\Database\Eloquent\Model $subject = null): \Capell\PrivacyCenter\Models\PrivacyRequest
{
return \Capell\PrivacyCenter\Actions\OpenPrivacyRequestAction::run($requestData, $requester, $subject);
}
<?php
declare(strict_types=1);
namespace App\CapellExamples\PrivacyCenter;
function runRecordConsent(\Capell\PrivacyCenter\Data\ConsentRecordData $consentData, ?\Illuminate\Database\Eloquent\Model $subject = null, ?\Illuminate\Database\Eloquent\Model $source = null): \Capell\PrivacyCenter\Models\ConsentRecord
{
return \Capell\PrivacyCenter\Actions\RecordConsentAction::run($consentData, $subject, $source);
}
<?php
declare(strict_types=1);
namespace App\CapellExamples\PrivacyCenter;
function runRecordPolicyAcceptance(\Capell\PrivacyCenter\Data\PolicyAcceptanceData $acceptanceData, ?\Illuminate\Database\Eloquent\Model $subject = null): \Capell\PrivacyCenter\Models\PolicyAcceptance
{
return \Capell\PrivacyCenter\Actions\RecordPolicyAcceptanceAction::run($acceptanceData, $subject);
}
<?php
declare(strict_types=1);
namespace App\CapellExamples\PrivacyCenter;
function runRegisterConsentPolicy(\Capell\PrivacyCenter\Data\ConsentPolicyData $policyData): \Capell\PrivacyCenter\Models\ConsentPolicy
{
return \Capell\PrivacyCenter\Actions\RegisterConsentPolicyAction::run($policyData);
}