Skip to content

License Activation Model

DB Table Name{wp_db_prefix}_fct_license_activations
SchemaCheck Schema
Source Filefluent-cart-pro/app/Modules/Licensing/Models/LicenseActivation.php
Name SpaceFluentCartPro\App\Modules\Licensing\Models
ClassFluentCartPro\App\Modules\Licensing\Models\LicenseActivation
PluginFluentCart Pro

Attributes

AttributeData TypeComment
idIntegerPrimary Key
site_idIntegerForeign key to license sites
license_idIntegerForeign key to licenses
statusStringActivation status
is_localBooleanWhether this is a local activation
product_idIntegerAssociated product ID
last_update_dateDateTimeLast update timestamp
last_update_versionStringLast update version
variation_idIntegerProduct variation ID
activation_methodStringMethod used for activation
activation_hashStringUnique activation hash
created_atDateTimeCreation timestamp
updated_atDateTimeLast update timestamp

Relationships

Belongs To

License

  • Method: license()
  • Type: BelongsTo
  • Model: FluentCartPro\App\Modules\Licensing\Models\License
  • Foreign Key: license_id
  • Local Key: id

Site

  • Method: site()
  • Type: BelongsTo
  • Model: FluentCartPro\App\Modules\Licensing\Models\LicenseSite
  • Foreign Key: site_id
  • Local Key: id

Methods

Status Management

updateStatus($newStatus)

Updates the activation status and triggers related actions.

Parameters:

  • $newStatus (string) - New status value

Returns: $this - Current model instance

Actions Triggered:

  • fluent_cart_sl/license_activation_status_updated
  • fluent_cart_sl/license_activation_status_updated_to_{$newStatus}

Example:

php
$activation = LicenseActivation::find(1);
$activation->updateStatus('active');

Usage Examples

Creating License Activation

php
use FluentCartPro\App\Modules\Licensing\Models\LicenseActivation;

$activation = LicenseActivation::create([
    'site_id' => 1,
    'license_id' => 123,
    'status' => 'active',
    'is_local' => false,
    'product_id' => 456,
    'activation_method' => 'api',
    'activation_hash' => 'unique_hash_here'
]);

Querying Activations

php
// Get all activations for a license
$activations = LicenseActivation::where('license_id', 123)->get();

// Get active activations
$activeActivations = LicenseActivation::where('status', 'active')->get();

// Get activations with license relationship
$activationsWithLicense = LicenseActivation::with('license')->get();

Updating Activation Status

php
$activation = LicenseActivation::find(1);

// Update status (triggers actions)
$activation->updateStatus('inactive');

// Direct status update (no actions)
$activation->status = 'inactive';
$activation->save();

Previous/Next Navigation


FluentCart developer documentation