public function findByUser(UserInterface $user, $ipAddress = null)
	{
		$model = $this->createModel();
		$query = $model->where('user_id', '=', ($userId = $user->getId()));

		if ($ipAddress)
		{
			$query->where(function($query) use ($ipAddress) {
				$query->where('ip_address', '=', $ipAddress);
				$query->orWhere('ip_address', '=', NULL);
			});
		}

		if ( ! $throttle = $query->first())
		{
			$throttle = $this->createModel();
			$throttle->user_id = $userId;
			if ($ipAddress) $throttle->ip_address = $ipAddress;
			$throttle->save();
		}

		return $throttle;
	}
public function findByUser(UserInterface $user, $ipAddress = null)
	{
		$model = $this->createModel();
		$query = $model->where('user_id', '=', ($userId = $user->getId()));

		if ($ipAddress)
		{
			$query->where(function($query) use ($ipAddress) {
				$query->where('ip_address', '=', $ipAddress);
				$query->orWhere('ip_address', '=', NULL);
			});
		}

		if ( ! $throttle = $query->first())
		{
			$throttle = $this->createModel();
			$throttle->user_id = $userId;
			if ($ipAddress) $throttle->ip_address = $ipAddress;
			$throttle->save();
		}

		return $throttle;
	}
public function findByUser ( UserInterface $ user , $ ipAddress = null ) { $ model = $ this -> createModel ( ) ; $ query = $ model -> where ( 'user_id' , '=' , ( $ userId = $ user -> getId ( ) ) ) ; if ( $ ipAddress ) { $ query -> where ( function ( $ query ) use ( $ ipAddress ) { $ query -> where ( 'ip_address' , '=' , $ ipAddress ) ; $ query -> orWhere ( 'ip_address' , '=' , NULL ) ; } ) ; } if ( ! $ throttle = $ query -> first ( ) ) { $ throttle = $ this -> createModel ( ) ; $ throttle -> user_id = $ userId ; if ( $ ipAddress ) $ throttle -> ip_address = $ ipAddress ; $ throttle -> save ( ) ; } return $ throttle ; }
Finds a throttler by the given Model.

@param  \Cartalyst\Sentry\Users\UserInterface $user
@param  string  $ipAddress
@return \Cartalyst\Sentry\Throttling\ThrottleInterface
Finds a throttler by the given Model .