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#
| Method | Description |
|---|---|
->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): stringTranslated 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.
| Parameter | Type | Description |
|---|---|---|
$locale | ?string = null |
- Returns
string
labelGroup()#
abstract public static function labelGroup(): stringGroup of the labels of this code list in resources/lang/{locale}/codes.php.
- Returns
string