Skip to main content

HasLabelType

Adds label getter/setter for the current type. The label is passed to trans() when getting, so you can use translation keys or literal text.

Namespace

JobMetric\Typeify\Traits\HasLabelType

Methods

label(string $label): static

Set the label for the current type (translation key or literal text).

$postType->define('blog')->label('Blog Post');
$postType->define('news')->label('posts.types.news');

Throws: TypeifyTypeNotMatchException when no type is selected.

getLabel(): string

Get the label for the current type (run through trans()).

$postType->type('blog');
$label = $postType->getLabel();

Throws: TypeifyTypeNotMatchException when no type is selected.