class Label extends Model

Annotations on an image can have multiple labels. A label is e.g. the type of the object visible in the region of the annotation. So if you put a circle annotation around a rock, you would label the annotation with rock.

Labels can be ordered in a tree-like structure.

Traits

HasFactory

Properties

int $id
string $uuid

Methods

array
casts()

Get the attributes that should be cast.

Builder
scopeUsed(Builder $query)

Scope a query to used labels.

Label, $this>
parent()

The parent label if the labels are ordered in a tree-like structure.

LabelTree, $this>
tree()

The label tree this label belongs to.

Label, $this>
children()

The child labels of this label if they are ordered in a tree-like structue.

setColorAttribute(string|null $value)

Remove the optional '#' from a hexadecimal color.

bool
isUsed()

Determines if the label is used anywhere (e.g. attached to an annotation).

bool
canBeDeleted()

Determines if the label can be deleted.

Details

at line 33
protected array casts()

Get the attributes that should be cast.

Return Value

array

at line 49
Builder scopeUsed(Builder $query)

Scope a query to used labels.

Parameters

Builder $query

Return Value

Builder

at line 71
Label, $this> parent()

The parent label if the labels are ordered in a tree-like structure.

Return Value

Label, $this>

at line 81
LabelTree, $this> tree()

The label tree this label belongs to.

Return Value

LabelTree, $this>

at line 92
Label, $this> children()

The child labels of this label if they are ordered in a tree-like structue.

Return Value

Label, $this>

at line 100
setColorAttribute(string|null $value)

Remove the optional '#' from a hexadecimal color.

Parameters

string|null $value

at line 114
bool isUsed()

Determines if the label is used anywhere (e.g. attached to an annotation).

Return Value

bool

at line 127
bool canBeDeleted()

Determines if the label can be deleted.

A label can be deleted if it doesn't have any child labels and if it is not used anywhere (e.g. attached to an annotation).

Return Value

bool