kodeops / laravel-strapi
Strapi的Laravel封装。
dev-main
2023-01-05 14:11 UTC
Requires
- php: ^7.1.3|^8.0
- laravel/framework: ^8|^9
- spatie/laravel-activitylog: ^4.5
- spatie/laravel-package-tools: ^1.6.2
This package is auto-updated.
Last update: 2024-09-05 18:02:58 UTC
README
_ _ _____ ______ _______ _____ _____ _______
|____/ | | | \ |______ | | |_____] |______
| \_ |_____| |_____/ |______ |_____| | ______|
Laravel Strapi 封装
此包是一个封装,用于向Strapi发起REST API调用。
发送请求
REST API允许通过API端点访问内容类型。当创建内容类型时,Strapi会自动创建API端点。在查询API端点时,可以使用API参数来细化结果。
use kodeops\LaravelStrapi\Strapi;
$collection = 'tgam-artist';
$params = [
'populate' => 'deep',
];
$loop_results = true;
Strapi::request($collection, $params, $loop_results);
更新集合项
use kodeops\LaravelStrapi\Strapi;
$collection = 'tgam-artist';
$params = [
'data' => [
'title' => A title for the collection item',
],
];
Strapi::update($collection, $params);
创建集合项
use kodeops\LaravelStrapi\Strapi;
$collection = 'tgam-artists';
$params = [
'data' => [
'title' => A title for the collection item',
'description' => A description for the collection item',
'url' => A url for the collection item',
],
];
Strapi::create($collection, $params);