Skip to content

API reference / Quittio \ Core \ Enums \ Concerns

HasLabel

trait in quittio/core

Quittio\Core\Enums\Concerns\HasLabel · Source

Translated labels for code list enums, e.g. "Stunde" for HUR.

Labels live in resources/lang/{locale}/codes.php under the enum's label group.

Methods#

MethodDescription
->label()Translated label of the code in $locale (null: the translator's locale), e.g. "Stunde" for HUR; the code itself when neither $locale nor English has a label.
::labelGroup()Group of the labels of this code list in resources/lang/{locale}/codes.php.

label()#

public function label(?string $locale = null): string

Translated label of the code in $locale (null: the translator's locale), e.g. "Stunde" for HUR; the code itself when neither $locale nor English has a label.

ParameterTypeDescription
$locale?string = null
Returns
string

labelGroup()#

abstract public static function labelGroup(): string

static abstract

Group of the labels of this code list in resources/lang/{locale}/codes.php.

Returns
string

The open core packages are MIT licensed. The legal wording of the country packs must be confirmed by a tax adviser.