PHP Trait Mpociot\Teamwork\Traits\UserHasTeams

Afficher le fichier Open project: mpociot/teamwork

Méthodes publiques

Méthode Description
attachTeam ( mixed $team, array $pivotData = [] ) Alias to eloquent many-to-many relation's attach() method.
attachTeams ( mixed $teams ) Attach multiple teams to a user
bootUserHasTeams ( ) : void | boolean Boot the user model Attach event listener to remove the many-to-many records when trying to delete Will NOT delete any records if the user model uses soft deletes.
currentTeam ( ) : Illuminate\Database\Eloquent\Relations\HasOne has-one relation with the current selected team model.
detachTeam ( mixed $team ) Alias to eloquent many-to-many relation's detach() method.
detachTeams ( mixed $teams ) Detach multiple teams from a user
invites ( ) : mixed One-to-Many relation with the invite model
isOwner ( ) : boolean Returns if the user owns a team
isOwnerOfTeam ( mixed $team ) : boolean Returns if the user owns the given team
isTeamOwner ( ) : boolean Wrapper method for "isOwner"
ownedTeams ( ) : mixed
switchTeam ( object | array | integer $team ) Switch the current team of the user
teams ( ) : Illuminate\Database\Eloquent\Relations\BelongsToMany Many-to-Many relations with the user model.

Méthodes protégées

Méthode Description
retrieveTeamId ( $team ) : mixed

Method Details

attachTeam() public méthode

Alias to eloquent many-to-many relation's attach() method.
public attachTeam ( mixed $team, array $pivotData = [] )
$team mixed
$pivotData array

attachTeams() public méthode

Attach multiple teams to a user
public attachTeams ( mixed $teams )
$teams mixed

bootUserHasTeams() public static méthode

Boot the user model Attach event listener to remove the many-to-many records when trying to delete Will NOT delete any records if the user model uses soft deletes.
public static bootUserHasTeams ( ) : void | boolean
Résultat void | boolean

currentTeam() public méthode

has-one relation with the current selected team model.
public currentTeam ( ) : Illuminate\Database\Eloquent\Relations\HasOne
Résultat Illuminate\Database\Eloquent\Relations\HasOne

detachTeam() public méthode

Alias to eloquent many-to-many relation's detach() method.
public detachTeam ( mixed $team )
$team mixed

detachTeams() public méthode

Detach multiple teams from a user
public detachTeams ( mixed $teams )
$teams mixed

invites() public méthode

One-to-Many relation with the invite model
public invites ( ) : mixed
Résultat mixed

isOwner() public méthode

Returns if the user owns a team
public isOwner ( ) : boolean
Résultat boolean

isOwnerOfTeam() public méthode

Returns if the user owns the given team
public isOwnerOfTeam ( mixed $team ) : boolean
$team mixed
Résultat boolean

isTeamOwner() public méthode

Wrapper method for "isOwner"
public isTeamOwner ( ) : boolean
Résultat boolean

ownedTeams() public méthode

public ownedTeams ( ) : mixed
Résultat mixed

retrieveTeamId() protected méthode

protected retrieveTeamId ( $team ) : mixed
$team
Résultat mixed

switchTeam() public méthode

Switch the current team of the user
public switchTeam ( object | array | integer $team )
$team object | array | integer

teams() public méthode

Many-to-Many relations with the user model.
public teams ( ) : Illuminate\Database\Eloquent\Relations\BelongsToMany
Résultat Illuminate\Database\Eloquent\Relations\BelongsToMany