Hi,
I am using Uniform for handling a form submission, and as part of this I am storing the submission in a log file.
I am adding some data in to the email, and would like to also add this to the log file. Is it possible to append this additional data so it appears in the log?
Below is my controller:
<?php
use Uniform\Form;
return function ($kirby, $page)
{
$form = new Form([
'email' => [
'rules' => ['required', 'email'],
'message' => 'Please enter a valid email address',
],
'forename' => [
'rules' => ['required'],
'message' => 'Please enter your first name',
],
'surname' => [
'rules' => ['required'],
'message' => 'Please enter your last name',
],
]);
if ($kirby->request()->is('POST')) {
$form->honeypotGuard()->honeytimeGuard([
'key' => c::get('uniform.honeytime.key'),
'seconds' => 3,
])->logAction([
'file' => kirby()->roots()->site().'/applications.log',
])->emailAction([
'to' => 'me@example.com',
'from' => 'info@example.com',
'template' => 'simple',
'subject' => 'New application for '. $page->title() . ' role for ' . $page->client(),
'data' => [
'role' => $page->title(),
'client' => $page->client(),
'job ID' => $page->jobId(),
],
])->done();
}
return compact('form');
};