Skip to content

Commit

Permalink
🐛 load apiroutes
Browse files Browse the repository at this point in the history
Signed-off-by: bnomei <b@bnomei.com>
  • Loading branch information
bnomei committed Sep 4, 2023
1 parent e1663e8 commit b3309ff
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
28 changes: 14 additions & 14 deletions classes/Autoloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -360,21 +360,21 @@ public function toArray(array $merge = []): array
// merge each on its own to allow cross loading between registries
// like a pageModel to load a blueprint
$types = [
'blueprints' => fn() => $this->blueprints(),
'collections' => fn() => $this->collections(),
'commands' => fn() => $this->commands(),
'controllers' => fn() => $this->controllers(),
'blockModels' => fn() => $this->blockModels(),
'pageModels' => fn() => $this->pageModels(),
'userModels' => fn() => $this->userModels(),
'snippets' => fn() => $this->snippets(),
'templates' => fn() => $this->templates(),
'translations' => fn() => $this->translations(),
'api' => fn() => ['routes' => fn() => $this->routes('api')],
'routes' => fn() => $this->routes(),
fn () => ['blueprints' => $this->blueprints()],
fn () => ['collections' => $this->collections()],
fn () => ['commands' => $this->commands()],
fn () => ['controllers' => $this->controllers()],
fn () => ['blockModels' => $this->blockModels()],
fn () => ['pageModels' => $this->pageModels()],
fn () => ['userModels' => $this->userModels()],
fn () => ['snippets' => $this->snippets()],
fn () => ['templates' => $this->templates()],
fn () => ['translations' => $this->translations()],
fn () => ['api' => ['routes' => $this->apiRoutes()]],
fn () => ['routes' => $this->routes()],
];
foreach ($types as $key => $callback) {
$this->registry[$key] = array_merge_recursive(A::get($this->registry, $key, []), $callback());
foreach ($types as $callback) {
$this->registry = array_merge_recursive($this->registry, $callback());
}

// merge on top but do not store in the registry
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "bnomei/autoloader-for-kirby",
"type": "project",
"version": "1.10.1",
"version": "1.10.2",
"license": "MIT",
"description": "Helper to automatically load various Kirby extensions in a plugin",
"authors": [
Expand Down
8 changes: 4 additions & 4 deletions vendor/composer/installed.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php return array(
'root' => array(
'name' => 'bnomei/autoloader-for-kirby',
'pretty_version' => '1.10.1',
'version' => '1.10.1.0',
'pretty_version' => '1.10.2',
'version' => '1.10.2.0',
'reference' => NULL,
'type' => 'project',
'install_path' => __DIR__ . '/../../',
Expand All @@ -11,8 +11,8 @@
),
'versions' => array(
'bnomei/autoloader-for-kirby' => array(
'pretty_version' => '1.10.1',
'version' => '1.10.1.0',
'pretty_version' => '1.10.2',
'version' => '1.10.2.0',
'reference' => NULL,
'type' => 'project',
'install_path' => __DIR__ . '/../../',
Expand Down

0 comments on commit b3309ff

Please sign in to comment.