create and delete notification for a project working
This commit is contained in:
parent
8c6e21c707
commit
9222069ef5
9 changed files with 105 additions and 52 deletions
|
|
@ -1,22 +1,23 @@
|
|||
<?php
|
||||
function getProjectData($project) {
|
||||
return [
|
||||
'title' => $project->title()->value(),
|
||||
'url' => $project->url(),
|
||||
'uri' => '/' . $project->uri(),
|
||||
'modified' => $project->modified('Y-MM-d'),
|
||||
'currentStep' => $project->currentStep()->value(),
|
||||
'status' => $project->status(),
|
||||
'logo' => $project->client()->toPage() ? $project->client()->toPage()->logo()->toFile()->url() : '',
|
||||
'steps' => $project->getSteps(),
|
||||
"title" => $project->title()->value(),
|
||||
"url" => $project->url(),
|
||||
"uri" => "/" . $project->uri(),
|
||||
"modified" => $project->modified("Y-MM-d"),
|
||||
"currentStep" => $project->currentStep()->value(),
|
||||
"status" => $project->status(),
|
||||
"logo" => $project->client()->toPage() ? $project->client()->toPage()->logo()->toFile()->url() : "",
|
||||
"steps" => $project->getSteps(),
|
||||
"notifications" => Yaml::decode($project->notifications()->value),
|
||||
"uuid" => (string) $project->uuid()
|
||||
];
|
||||
}
|
||||
|
||||
try {
|
||||
$children = $kirby->user()->role() == 'admin' ? $page->children()->map(fn($project) => getProjectData($project))->values() : $kirby->user()->projects()->toPages()->map(fn($project) => getProjectData($project))->values();
|
||||
$children = $kirby->user()->role() == "admin" ? $page->children()->map(fn($project) => getProjectData($project))->values() : $kirby->user()->projects()->toPages()->map(fn($project) => getProjectData($project))->values();
|
||||
} catch (\Throwable $th) {
|
||||
throw new Exception($th->getMessage() . ' line ' . $th->getLine(), 1);
|
||||
throw new Exception($th->getMessage() . " line " . $th->getLine(), 1);
|
||||
$children = [];
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue