private function revokeMembership($user)
    {
        try {

            foreach($user->membershipList as $group) {
                if ($group->resync_on_login) {
                    $user->membershipList()->detach($group);
                }
            }

        } catch (\Exception $ex) {
            Log::error('Exception revoking local group membership for user: ' . $user->username . ', Exception message: ' . $ex->getMessage());
            Log::error($ex->getTraceAsString());
        }

    }
private function revokeMembership($user)
    {
        try {

            foreach($user->membershipList as $group) {
                if ($group->resync_on_login) {
                    $user->membershipList()->detach($group);
                }
            }

        } catch (\Exception $ex) {
            Log::error('Exception revoking local group membership for user: ' . $user->username . ', Exception message: ' . $ex->getMessage());
            Log::error($ex->getTraceAsString());
        }

    }
private function revokeMembership ( $ user ) { try { foreach ( $ user -> membershipList as $ group ) { if ( $ group -> resync_on_login ) { $ user -> membershipList ( ) -> detach ( $ group ) ; } } } catch ( \ Exception $ ex ) { Log :: error ( 'Exception revoking local group membership for user: ' . $ user -> username . ', Exception message: ' . $ ex -> getMessage ( ) ) ; Log :: error ( $ ex -> getTraceAsString ( ) ) ; } }
Revoke membership to all local group that are marked with
'resync_on_login' as 1 or true.

@param $user The user to revoke group membership from.
Revoke membership to all local group that are marked with resync_on_login as 1 or true .