public function getProfile($network = NULL, $user = NULL)
	{
		//if the supplied $user value is null, use the current user
		if ($user === NULL)
		{
			$user = Auth::user();

			//if there is no current user, exit out
			if (!$user)
			{
				return NULL;
			}
		}

		//if the provided network is null, grab the user's first existing social profile
		if ($network === NULL)
		{
			$profile = $user->profiles()->first();
		}
		//otherwise get the specific social profile for this network
		else
		{
			$profile = $user->profiles()->where('network', $network)->first();
		}

		return $profile;
	}
public function getProfile($network = NULL, $user = NULL)
	{
		//if the supplied $user value is null, use the current user
		if ($user === NULL)
		{
			$user = Auth::user();

			//if there is no current user, exit out
			if (!$user)
			{
				return NULL;
			}
		}

		//if the provided network is null, grab the user's first existing social profile
		if ($network === NULL)
		{
			$profile = $user->profiles()->first();
		}
		//otherwise get the specific social profile for this network
		else
		{
			$profile = $user->profiles()->where('network', $network)->first();
		}

		return $profile;
	}
public function getProfile ( $ network = NULL , $ user = NULL ) { //if the supplied $user value is null, use the current user if ( $ user === NULL ) { $ user = Auth :: user ( ) ; //if there is no current user, exit out if ( ! $ user ) { return NULL ; } } //if the provided network is null, grab the user's first existing social profile if ( $ network === NULL ) { $ profile = $ user -> profiles ( ) -> first ( ) ; } //otherwise get the specific social profile for this network else { $ profile = $ user -> profiles ( ) -> where ( 'network' , $ network ) -> first ( ) ; } return $ profile ; }
Get a social profile for a user, optionally specifying which social network to get, and which user to query
Get a social profile for a user optionally specifying which social network to get and which user to query