<?php

Kirby::plugin('adrienpayet/pdc-authorized-projects', [
  'userMethods' => [
    'currentProjects' => function() {
      if ($this->role() == 'admin') {
        return page('projects')->children()->listed();
      } else {
        return $this->projects()->toPages()->listed();
      }
    },
    'archivedProjects' => function() {
      if ($this->role() == 'admin') {
        return page('projects')->children()->unlisted();
      } else {
        return $this->projects()->toPages()->unlisted();
      }
    },
  ]
]);
