public function log($ipAddress = null, UserInterface $user = null)
{
$global = $this->createModel();
$global->fill(['type' => 'global']);
$global->save();
if ($ipAddress !== null) {
$ipAddressThrottle = $this->createModel();
$ipAddressThrottle->fill(['type' => 'ip', 'ip' => $ipAddress]);
$ipAddressThrottle->save();
}
if ($user !== null) {
$userThrottle = $this->createModel();
$userThrottle->fill(['type' => 'user']);
$userThrottle->user_id = $user->getUserId();
$userThrottle->save();
}
}