class LabelTree extends Model

A label tree is a group of labels. Projects can choose to used different label trees, which are then offered for labeling things in the project.

Label trees have admins and editors as members. Editors can add and delete labels. Admins can also manage members and modify the tree (name, visibility etc). Label trees can be public or private. Private trees maintain a list of projects that are authorized to use the tree. This list is maintained by label tree admins.

Traits

HasFactory

Properties

string $uuid

Methods

array
casts()

Get the attributes that should be cast.

bool
memberCanLooseAdminStatus(User $member)

Check if a member can loose their admin status.

LabelTree>
scopePublicTrees(LabelTree> $query)

Scope a query to public label trees.

LabelTree>
scopePrivateTrees(LabelTree> $query)

Scope a query to private label trees.

LabelTree>
scopeAccessibleBy(LabelTree> $query, User $user)

Scope a query to all trees that are accessible by a user.

LabelTree>
scopeWithoutVersions(LabelTree> $query)

Scope a query to all trees that are not a varsion of another tree.

LabelTree>
scopeGlobal(LabelTree> $query)

Scope a query to all "global" trees.

LabelTreeVersion, $this>
version()

The version of this label tree (if it is a version of a master label tree).

LabelTreeVersion, $this>
versions()

The versions of this (master) label tree.

Visibility, $this>
visibility()

The visibility of the label tree.

User, $this>
members()

The members of this label tree. Every member has a tree-specific role.

Label, $this>
labels()

The labels that belong to this tree.

bool
canBeDeleted()

Determines if the label tree can be safely deleted.

addMember(User|int $user, Role|int $role)

Add a new member with a certain role.

updateMember(User|int $user, Role|int $role)

Update a member (role).

bool
memberCanBeRemoved(User $member)

Determines if a member can be removed.

Project, $this>
projects()

The projects that are using this label tree.

Project, $this>
authorizedProjects()

The projects that are authorized to use this private label tree.

detachUnauthorizedProjects()

Detaches all projects that are not among the authorized projects.

string
getVersionedNameAttribute()

Get the name with a version suffix of this label tree.

replicateLabelsOf(LabelTree $tree)

Replicate all labels of one label tree to this one.

Details

at line 31
protected array casts()

Get the attributes that should be cast.

Return Value

array

at line 45
bool memberCanLooseAdminStatus(User $member)

Check if a member can loose their admin status.

Parameters

User $member

Return Value

bool

at line 59
LabelTree> scopePublicTrees(LabelTree> $query)

Scope a query to public label trees.

Parameters

LabelTree> $query

Return Value

LabelTree>

at line 70
LabelTree> scopePrivateTrees(LabelTree> $query)

Scope a query to private label trees.

Parameters

LabelTree> $query

Return Value

LabelTree>

at line 82
LabelTree> scopeAccessibleBy(LabelTree> $query, User $user)

Scope a query to all trees that are accessible by a user.

Parameters

LabelTree> $query
User $user

Return Value

LabelTree>

at line 120
LabelTree> scopeWithoutVersions(LabelTree> $query)

Scope a query to all trees that are not a varsion of another tree.

Parameters

LabelTree> $query

Return Value

LabelTree>

at line 132
LabelTree> scopeGlobal(LabelTree> $query)

Scope a query to all "global" trees.

Parameters

LabelTree> $query

Return Value

LabelTree>

at line 144
LabelTreeVersion, $this> version()

The version of this label tree (if it is a version of a master label tree).

Return Value

LabelTreeVersion, $this>

at line 154
LabelTreeVersion, $this> versions()

The versions of this (master) label tree.

Return Value

LabelTreeVersion, $this>

at line 164
Visibility, $this> visibility()

The visibility of the label tree.

Return Value

Visibility, $this>

at line 174
User, $this> members()

The members of this label tree. Every member has a tree-specific role.

Return Value

User, $this>

at line 186
Label, $this> labels()

The labels that belong to this tree.

Return Value

Label, $this>

at line 198
bool canBeDeleted()

Determines if the label tree can be safely deleted.

A label tree can be safely deleted if none if its labels or the labels of any of its versions are in use.

Return Value

bool

at line 214
addMember(User|int $user, Role|int $role)

Add a new member with a certain role.

Parameters

User|int $user
Role|int $role

at line 233
updateMember(User|int $user, Role|int $role)

Update a member (role).

Parameters

User|int $user
Role|int $role

at line 254
bool memberCanBeRemoved(User $member)

Determines if a member can be removed.

A member can be removed if at least one admin member remains afterwards.

Parameters

User $member

Return Value

bool

at line 264
Project, $this> projects()

The projects that are using this label tree.

Return Value

Project, $this>

at line 274
Project, $this> authorizedProjects()

The projects that are authorized to use this private label tree.

Return Value

Project, $this>

at line 282
detachUnauthorizedProjects()

Detaches all projects that are not among the authorized projects.

at line 308
string getVersionedNameAttribute()

Get the name with a version suffix of this label tree.

Return Value

string

at line 322
replicateLabelsOf(LabelTree $tree)

Replicate all labels of one label tree to this one.

Parameters

LabelTree $tree