<?php

return [
  'pattern' => '(:all)read-all-notifications.json',
  'method' => 'GET',
  'action'  => function () {
      $projects = page("projects");

      foreach ($projects->children() as $project) {
        try {
          $project->readAllNotifications();
          return json_encode([
            "status" => "success"
          ]);
        } catch (\Throwable $th) {
          return json_encode([
            "status" => "error",
            "message" => $th->getMessage() . ' line ' . $th->getLine() . " in file " . $th->getFile()
          ]);
        }
      }
  }
];