inviteToTeam() public method

Either provide a email address or an object with an email property. If no team is given, the current_team_id will be used instead.
public inviteToTeam ( string | User $user, null | Team $team = null, callable $success = null )
$user string | User
$team null | Team
$success callable
Example #1
0
 public function testCanNotInviteToUserWithoutEmail()
 {
     /*
     |------------------------------------------------------------
     | Set
     |------------------------------------------------------------
     */
     $email = "*****@*****.**";
     $team_id = 1;
     $app = m::mock('App');
     $teamwork = new Teamwork($app);
     $app->auth = m::mock('Auth');
     $user = m::mock('User');
     $user->current_team_id = $team_id;
     $user->shouldReceive('getKey')->never();
     $app->auth->shouldReceive('user')->andReturn($user);
     $app->shouldReceive('make')->with('Mpociot\\Teamwork\\TeamInvite')->never();
     $this->setExpectedException('Exception', 'The provided object has no "email" attribute and is not a string.');
     $teamwork->inviteToTeam($user);
 }
Example #2
0
 /**
  * Invite an email adress to a team.
  * 
  * Either provide a email address or an object with an email property.
  * 
  * If no team is given, the current_team_id will be used instead.
  *
  * @param string|\Mpociot\Teamwork\User $user
  * @param null|\Mpociot\Teamwork\Team $team
  * @param callable $success
  * @throws \Exception
  * @static 
  */
 public static function inviteToTeam($user, $team = null, $success = null)
 {
     return \Mpociot\Teamwork\Teamwork::inviteToTeam($user, $team, $success);
 }