public function addRole($role)
    {
        if ($role instanceof Role) {
            $role = $role->id;
        }

        // We don't want a double up on roles
        if (false !== array_search($role, (array) $this->attributes['roles'])) {
            return false;
        }

        $this->attributes['roles'][] = $role;

        return true;
    }
public function addRole($role)
    {
        if ($role instanceof Role) {
            $role = $role->id;
        }

        // We don't want a double up on roles
        if (false !== array_search($role, (array) $this->attributes['roles'])) {
            return false;
        }

        $this->attributes['roles'][] = $role;

        return true;
    }
public function addRole ( $ role ) { if ( $ role instanceof Role ) { $ role = $ role -> id ; } // We don't want a double up on roles if ( false !== array_search ( $ role , ( array ) $ this -> attributes [ 'roles' ] ) ) { return false ; } $ this -> attributes [ 'roles' ] [ ] = $ role ; return true ; }
Adds a role to the member.

@param Role|int $role The role to add to the member.

@return bool Whether adding the role succeeded.
Adds a role to the member .