奶媒 / getcontent
GetContent CMS
0.2.6
2019-08-22 14:41 UTC
Requires
- php: >=7.1.3
- doctrine/dbal: ^2.9
- illuminate/support: ^5.7 || ^5.8
- kalnoy/nestedset: ^4.3
- league/glide-laravel: ^1.0
- loilo/fuse: ^3.3
- owen-it/laravel-auditing: ^8.0 || ^9.0
- spatie/laravel-query-builder: ^1.17.1
- spatie/laravel-schemaless-attributes: ^1.2
Requires (Dev)
- mockery/mockery: ~1.0
- orchestra/testbench: 3.7.*
- orchestra/testbench-dusk: 3.7.*
- phpunit/phpunit: ~7.0
This package is auto-updated.
Last update: 2024-09-29 05:02:02 UTC
README
GetContent CMS 是一个 Laravel 扩展包,它提供了一个无结构的、无头的内容 API,您可以在自己的 Laravel 项目中使用。它自带用户界面,用于管理内容和媒体。
安装
迁移
… 为 users
表添加一个 settings
json
列。
路由
routes/api.php
Route::middleware('auth:api')->group(function () {
GetContent::apiRoutes();
});
routes/web.php
Route::middleware('auth')->group(function () {
GetContent::editorRoutes();
});
GetContent::webRoutes();
用户、认证和授权
GetContent 有自己的 User
模型,您应该扩展它
开发
测试
在端口 5532
上启动 postgres 实例并运行 phpunit
。
docker-compose -f tests/docker-compose.yml up -d
./vendor/phpunit/phpunit/phpunit
稍后...
docker-compose -f tests/docker-compose.yml down
测试 Gitlab CI
gitlab-runner exec docker phpunit
文档
内容存储在文档中。文档有一个 model
和一个 schema
。
模型
模型是一个简单的键:值对象,包含一个 value
和您希望添加的任何其他可选属性。
{
"content1": {
"value": "<p>This is some content</p>"
}
}
模式
模式是一个对象数组,它定义了在模型中存储的数据类型以及如何布局表单。默认情况下,模式是灵活的,因此您可以添加任意数量的字段,以任意顺序排列。但是,您也可以创建一个固定模式,以便给定的文档强制执行一个模式。
[
{
"type": "content",
"model": "content1",
"label": "Body Content",
"instructions": "Enter some content here.",
"options": {}
}
]
模板
模板是一种字段类型,它将多个其他字段组合在一起。
[
{
"type": "template",
"model": "content1",
"template": {
"fields": [
{
"type": "content",
"model": "content1"
},
{
"type": "media",
"model": "media1"
}
]
}
}
]
或者,您可以使用全局定义的模板
[
{
"type": "template",
"model": "content1",
"template": "contentWithImage"
}
]
复制字段集
复制字段集允许您添加多个字段的实例。
[
{
"type": "template",
"model": "socialLinks",
"template": {
"replicator": true,
"sets": [
{
"display": "Social Link",
"fields": {
"url": {
"type": "text",
"model": "url",
"placeholder": "Social profile URL"
}
}
}
]
}
}
]
用户权限
用户可以限制访问特定内容区域。
文档和文件
{
"permissions": {
"filesRootDirectory": "subdirectory",
"groupRootId": 2
}
}