✨feature: Add projects homepage and support for adding new projects
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
// phpcs:disable PEAR.Commenting.FileComment,PEAR.Commenting.ClassComment
|
||||
|
||||
/**
|
||||
* Create a new project.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
$boardService = include __DIR__ . '/_bootstrap.php';
|
||||
|
||||
use IronKanban\Support\Http;
|
||||
use IronKanban\Support\HttpHalt;
|
||||
|
||||
try {
|
||||
Http::requireMethod('POST');
|
||||
Http::verifyCsrf();
|
||||
$input = Http::input();
|
||||
|
||||
Http::json(
|
||||
[
|
||||
'success' => true,
|
||||
'state' => $boardService->createProject(
|
||||
trim((string) ($input['title'] ?? 'Untitled Project')),
|
||||
trim((string) ($input['body'] ?? '')),
|
||||
isset($input['slug']) ? trim((string) $input['slug']) : null
|
||||
),
|
||||
]
|
||||
);
|
||||
} catch (HttpHalt $halt) {
|
||||
return;
|
||||
} catch (Throwable $exception) {
|
||||
Http::error($exception->getMessage(), 500);
|
||||
}
|
||||
Reference in New Issue
Block a user