public function switchCurrentTeam(Request $request, $teamId)
    {
        $user = $request->user();

        $team = $user->teams()->findOrFail($teamId);

        $user->switchToTeam($team);

        return back();
    }
public function switchCurrentTeam(Request $request, $teamId)
    {
        $user = $request->user();

        $team = $user->teams()->findOrFail($teamId);

        $user->switchToTeam($team);

        return back();
    }
public function switchCurrentTeam ( Request $ request , $ teamId ) { $ user = $ request -> user ( ) ; $ team = $ user -> teams ( ) -> findOrFail ( $ teamId ) ; $ user -> switchToTeam ( $ team ) ; return back ( ) ; }
Switch the team the user is currently viewing.

@param  \Illuminate\Http\Request  $request
@param  string  $teamId
@return \Illuminate\Http\Response
Switch the team the user is currently viewing .