Adminix Documentation Help

Display value

DisplayValueModule renders one field from one database row as a compact dashboard card. Use it for values such as an order status, an application setting, or the name of a server-selected record.

Configuration

Create the module through the public factory and attach it to a page:

use AlexKudrya\Adminix\Modules\Module; use App\Models\Order; $page->addModule( Module::displayValue() ->name('order-status') ->title('Order status') ->dataSource(Order::class) ->criteria([ ['id', '=', 'param:0'], ]) ->fieldName('status') ->icon('bi bi-receipt') ->hoverScale() );

For a page opened as /adminix/orders/42, param:0 resolves to 42. Adminix applies the server-side criteria to the configured Order datasource, reads the status field from the first matching row, and renders it below the Order status title. The icon uses a Bootstrap Icons class.

The module supports:

Method

Purpose

name(string)

Required module identifier, unique on the page.

title(string)

Required visible card title.

dataSource(string)

Required Eloquent model class or database table name.

criteria(array)

Optional server-declared query criteria.

fieldName(string)

Required column or model attribute to display.

icon(string)

Optional CSS icon classes.

hoverScale()

Optional value and icon enlargement on hover. Disabled by default.

withoutHoverScale()

Explicitly restore the static default when the option is set conditionally.

Query behavior and safety

DisplayValueModule calls first() after applying its criteria; it does not aggregate rows and does not define an ordering option. Use criteria that identify a single row when the selected value must be deterministic. If no row matches, the card renders an empty value.

Datasource and criteria come from the PHP module configuration. Route parameters can narrow that server-owned query, but they are not authorization by themselves. Keep tenant scope and record access in policies, trusted provider context, model scopes, or additional criteria, and never let the browser choose a datasource or field name.

Run php artisan adminix:doctor --strict in the consuming application after adding the module. Doctor reports missing names or titles, invalid datasources or criteria, and a missing fieldName(). A missing title is a rendering error: the Blade component intentionally skips the entire card until title() is configured.

Last modified: 23 July 2026