__construct()
public function __construct(?string $module_name = null)
Description
Constructor for the Trongate_tokens module. Calls parent constructor and blocks direct URL access.
Note: The framework automatically instantiates Trongate_tokens via $this->trongate_tokens. You rarely need to call this constructor manually.
Parameters
| Parameter | Type | Description | Default | Required |
|---|---|---|---|---|
| module_name | string|null | The module name (passed by framework for integration with Trongate module system). | null | No |
Return Value
| Type | Description |
|---|---|
| void | Constructor does not return a value. |
Example Usage
PHP
<?php
// Automatic instantiation by framework (inside a controller)
class Products extends Trongate {
public function api() {
// $this->trongate_tokens is automatically an instance
$token = $this->trongate_tokens->attempt_get_valid_token();
}
}
// Manual instantiation (rare)
$tokens = new Trongate_tokens('products');