Daniel J. Summers 20ad50928a Move files, complete PHP migration
The application works the same way as the F# version
2024-06-23 16:35:55 -04:00

22 lines
660 B
PHP

<?php declare(strict_types=1);
use BitBadger\PDODocument\Patch;
use MyPrayerJournal\Domain\{History, RecurrencePeriod, RequestAction};
use MyPrayerJournal\Table;
use MyPrayerJournal\UI\Component;
require '../../start.php';
$req = validate_request($_GET['id'], ['PATCH'], false);
$now = new DateTimeImmutable('now');
array_unshift($req->history, new History($now->format('c'), RequestAction::Prayed));
$patch = ['history' => $req->history];
if ($req->recurrence->period <> RecurrencePeriod::Immediate) {
$patch['showAfter'] = $now->add($req->recurrence->interval())->format('c');
}
Patch::byId(Table::REQUEST, $req->id, $patch);
Component::journal();