Use option for req-by-ID
This commit is contained in:
@@ -13,14 +13,13 @@ $isNew = $_GET['id'] == 'new';
|
||||
|
||||
$req = match ($isNew) {
|
||||
true => new Request('new'),
|
||||
false => Request::byId($_GET['id'])
|
||||
false => Request::byId($_GET['id'])->getOrCall(not_found(...))
|
||||
};
|
||||
if (!$req) not_found();
|
||||
|
||||
$cancelLink = match (true) {
|
||||
str_ends_with($_SERVER['HTTP_REFERER'] ?? '', 'active.php') => '/requests/active',
|
||||
str_ends_with($_SERVER['HTTP_REFERER'] ?? '', 'snoozed.php') => '/requests/snoozed',
|
||||
default => '/journal'
|
||||
str_ends_with($_SERVER['HTTP_REFERER'] ?? '', 'active') => '/requests/active',
|
||||
str_ends_with($_SERVER['HTTP_REFERER'] ?? '', 'snoozed') => '/requests/snoozed',
|
||||
default => '/journal'
|
||||
};
|
||||
$action = $_GET['id'] == 'new' ? 'Add' : 'Edit';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user