omatech/editora-astro-resource

dev-edge 2024-09-16 12:53 UTC

This package is auto-updated.

Last update: 2024-09-16 12:53:38 UTC


README

安装

在 composer.json 中添加包依赖

composer require omatech/editora-astro-resource

配置设置

config/editora.php 中设置配置选项

'astroToken' => 'hash'

使用

获取 URI

端点是预定义的,用于获取所有已发布的路由。使用令牌进行认证。

Headers: { astro-token: hash }
POST: /api/astro/routes

获取资源

在控制器中使用 AstroResource 提取数据并将其作为响应返回。

return AstroResource::resources(
    HomeExtraction::find($this->inst_id, $this->preview),
    GlobalExtraction::find(2, $this->preview),
    [
        'breadcrumbs' => PageExtraction::getBreadcrumbs($this->inst_id, $this->preview)
    ]
);