Documentation MyBrickStore

FinancialModel extends Model
in package

Class FinancialModel

  • Manages payment processing and financial records
  • Handles the transaction logic: saving payment details, creating orders, and generating invoices

Table of Contents

Properties

$table  : string

Methods

countOrders()  : int
Counts total number of orders placed
find()  : mixed
Finds a specific record by its ID.
findAll()  : array<string|int, mixed>|false
Retrieves all records from the associated table.
getLastOrders()  : array<string|int, mixed>
Retrieves the most recent orders for the admin dashboard
getTotalRevenue()  : float
Calculates total revenue from valid orders for admin kpis
processOrder()  : int|string
Executes the complete checkout transaction in a safe, atomic manner
requete()  : PDOStatement|false
Executes a SQL query (prepared or direct).

Properties

$table

protected string $table

The database table associated with the model.

Methods

countOrders()

Counts total number of orders placed

public countOrders() : int
Return values
int

find()

Finds a specific record by its ID.

public find(int $id) : mixed
Parameters
$id : int

The record identifier.

Return values
mixed

The record object or false if not found.

findAll()

Retrieves all records from the associated table.

public findAll() : array<string|int, mixed>|false
Return values
array<string|int, mixed>|false

List of records.

getLastOrders()

Retrieves the most recent orders for the admin dashboard

public getLastOrders([int $limit = 5 ]) : array<string|int, mixed>
Parameters
$limit : int = 5

number of orders to fetch

Return values
array<string|int, mixed>

getTotalRevenue()

Calculates total revenue from valid orders for admin kpis

public getTotalRevenue() : float
Return values
float

processOrder()

Executes the complete checkout transaction in a safe, atomic manner

public processOrder(int $userId, int $refMosaicId, array<string|int, mixed> $cardInfo, float $amount[, array<string|int, mixed> $billingInfo = [] ]) : int|string
Parameters
$userId : int

the customer identifier

$refMosaicId : int

the mosaic being purchased

$cardInfo : array<string|int, mixed>

payment provider details (e.g. paypal transaction id)

$amount : float

total cost

$billingInfo : array<string|int, mixed> = []

shipping and contact details

Return values
int|string

the new order id on success, or an error message on failure

requete()

Executes a SQL query (prepared or direct).

public requete(string $sql[, array<string|int, mixed>|null $attributs = null ]) : PDOStatement|false
Parameters
$sql : string

The SQL query string.

$attributs : array<string|int, mixed>|null = null

Optional parameters for prepared statements.

Return values
PDOStatement|false

The result statement.


        
On this page

Search results