You are here

public function LogController::report in TacJS 8.6

Store proof of consent.

Parameters

int $service: Unique ID of the service.

Return value

array Empty Array.

Throws

\Exception

1 string reference to 'LogController::report'
tacjs_log.routing.yml in tacjs_log/tacjs_log.routing.yml
tacjs_log/tacjs_log.routing.yml

File

tacjs_log/src/Controller/LogController.php, line 39

Class

LogController

Namespace

Drupal\tacjs_log\Controller

Code

public function report($service) {
  try {
    $this->connection
      ->insert('tacjslog')
      ->fields([
      'timestamp' => \Drupal::time()
        ->getCurrentTime(),
      'ip_address' => \Drupal::request()
        ->getClientIp(),
      'services_allowed' => $service,
    ])
      ->execute();
  } catch (\Exception $e) {
    throw $e;
  }
  return new JsonResponse([
    'timestamp' => \Drupal::time()
      ->getCurrentTime(),
    'ip_address' => \Drupal::request()
      ->getClientIp(),
    'services_allowed' => $service,
  ]);
}