PHP code example of goldnead / statamic-lead-magnets
1. Go to this page and download the library: Download goldnead/statamic-lead-magnets library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
goldnead / statamic-lead-magnets example snippets
use Goldnead\LeadMagnets\Facades\LeadMagnets;
$resource = LeadMagnets::resource('warm_up');
$grant = LeadMagnets::request($resource, '[email protected]', ['source' => 'api']);
$grant->state(); // Goldnead\Entitlements\Enums\EntitlementState
$grant->isRedeemable(); // the one question the download gate asks
LeadMagnets::downloadUrl($grant);
// Access questions go to entitlements, which answers them for every addon on
// the platform. There is deliberately no second facade over the same data.
use Goldnead\Entitlements\Facades\Entitlements;
use Goldnead\LeadMagnets\Support\LeadMagnetSubject;
Entitlements::allows(LeadMagnetSubject::for('[email protected]'), 'warm_up');
use Goldnead\LeadMagnets\Events\ResourceConfirmed;
Event::listen(ResourceConfirmed::class, function (ResourceConfirmed $event) {
$event->grant->email;
$event->payload(); // integration-shaped array, no secrets in it
});