class Project extends Model

Traits

HasFactory

Methods

Builder
scopeInCommon(Builder $query, User $user, int $volumeId, array $roles = null)

Scope a query to all projects that the user and the volume with the given ID have in common.

Builder
scopeAccessibleBy(Builder $query, User $user)

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

User, $this>
users()

The members of this project. Every member has a project-specific project_role_id besides their global user role.

User, $this>
admins()

All members of this project with the admin role.

User, $this>
editors()

All members of this project with the editor role.

User, $this>
guests()

All members of this project with the guest role.

User, $this>
creator()

The user that created this project. On creation this user is automatically added to the project's users with the 'admin' role by the ProjectObserver.

ProjectInvitation, $this>
invitations()

The project invitations of this project.

void
addUserId(int $userId, int $roleId)

Adds the user with the given role to this project.

void
changeRole(int $userId, int $roleId)

Changes the role of an existing user in this project.

bool
userCanBeRemoved(int $userId)

Determines if the user can be removed from the project.

bool
removeUserId(int $userId)

Removes the user by ID from this project.

Volume, $this>
volumes()

The volumes of this project.

Volume, $this>
imageVolumes()

The image volumes of this project.

Volume, $this>
videoVolumes()

The video volumes of this project.

PendingVolume, $this>
pendingVolumes()

The pending volumes of this project.

void
addVolumeId(int $id) deprecated

Adds a volume to this project if it wasn't already.

removeVolume(Volume $volume, bool $force = false)

Detaches the volume from this project. Fails if this is the last project, the volume is attached to, unless force is true.

removeAllVolumes(bool $force = false)

Detaches all volumes from this project. Fails if this is the last project, one of the volumes is attached to, unless force is true.

LabelTree, $this>
labelTrees()

The label trees, this project is using.

LabelTree, $this>
authorizedLabelTrees()

The private label trees that authorized this project to use them.

string
getThumbnailUrlAttribute()

URL to a unique thumbnail image for this project.

bool
hasGeoInfo()

Check if the project has volumes which have some images with GPS coordinates.

flushGeoInfoCache()

Flush the cached information if this project has volumes which have images with GPS coordinates.

Details

at line 30
Builder scopeInCommon(Builder $query, User $user, int $volumeId, array $roles = null)

Scope a query to all projects that the user and the volume with the given ID have in common.

Parameters

Builder $query
User $user
int $volumeId
array $roles

Array of role IDs to restrict the project membership to. Default is any role.

Return Value

Builder

at line 50
Builder scopeAccessibleBy(Builder $query, User $user)

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

Parameters

Builder $query
User $user

Return Value

Builder

at line 68
User, $this> users()

The members of this project. Every member has a project-specific project_role_id besides their global user role.

Return Value

User, $this>

at line 79
User, $this> admins()

All members of this project with the admin role.

Return Value

User, $this>

at line 89
User, $this> editors()

All members of this project with the editor role.

Return Value

User, $this>

at line 99
User, $this> guests()

All members of this project with the guest role.

Return Value

User, $this>

at line 111
User, $this> creator()

The user that created this project. On creation this user is automatically added to the project's users with the 'admin' role by the ProjectObserver.

Return Value

User, $this>

at line 121
ProjectInvitation, $this> invitations()

The project invitations of this project.

Return Value

ProjectInvitation, $this>

at line 133
void addUserId(int $userId, int $roleId)

Adds the user with the given role to this project.

Parameters

int $userId
int $roleId

Return Value

void

at line 145
void changeRole(int $userId, int $roleId)

Changes the role of an existing user in this project.

Parameters

int $userId
int $roleId

Return Value

void

at line 156
bool userCanBeRemoved(int $userId)

Determines if the user can be removed from the project.

Parameters

int $userId

Return Value

bool

at line 167
bool removeUserId(int $userId)

Removes the user by ID from this project.

Parameters

int $userId

Return Value

bool

at line 181
Volume, $this> volumes()

The volumes of this project.

Return Value

Volume, $this>

at line 191
Volume, $this> imageVolumes()

The image volumes of this project.

Return Value

Volume, $this>

at line 201
Volume, $this> videoVolumes()

The video volumes of this project.

Return Value

Volume, $this>

at line 211
PendingVolume, $this> pendingVolumes()

The pending volumes of this project.

Return Value

PendingVolume, $this>

at line 223
void addVolumeId(int $id) deprecated

deprecated Use `$project->volumes()->attach($id)` instead.

Adds a volume to this project if it wasn't already.

Parameters

int $id

Return Value

void

at line 238
removeVolume(Volume $volume, bool $force = false)

Detaches the volume from this project. Fails if this is the last project, the volume is attached to, unless force is true.

Parameters

Volume $volume
bool $force

Delete the volume completely if this is the last project it belongs to

at line 263
removeAllVolumes(bool $force = false)

Detaches all volumes from this project. Fails if this is the last project, one of the volumes is attached to, unless force is true.

Parameters

bool $force

at line 286
LabelTree, $this> labelTrees()

The label trees, this project is using.

Return Value

LabelTree, $this>

at line 296
LabelTree, $this> authorizedLabelTrees()

The private label trees that authorized this project to use them.

Return Value

LabelTree, $this>

at line 306
string getThumbnailUrlAttribute()

URL to a unique thumbnail image for this project.

Return Value

string

at line 327
bool hasGeoInfo()

Check if the project has volumes which have some images with GPS coordinates.

Return Value

bool

at line 339
flushGeoInfoCache()

Flush the cached information if this project has volumes which have images with GPS coordinates.