GetContent CMS
GetContent CMS is a Laravel package that provides an unstructured, headless content API to use within your own Laravel project. It comes with an user interface to manage content and media out of the box.
… Adds a settings
json
column to the users
table.
routes/api.php
Route::middleware('auth:api')->group(function () {
GetContent::apiRoutes();
});
routes/web.php
Route::middleware('auth')->group(function () {
GetContent::editorRoutes();
});
GetContent::webRoutes();
GetContent has it's own User
model that you should extend
Spin up postgres instance on port 5532
and run phpunit
.
docker-compose -f tests/docker-compose.yml up -d
./vendor/phpunit/phpunit/phpunit
Later…
docker-compose -f tests/docker-compose.yml down
gitlab-runner exec docker phpunit
Content is stored within a Document. A Document has a model
and a schema
.
The model is a simple key:value object containing a value
and any other
optional properties you wish.
{
"content1": {
"value": "<p>This is some content</p>"
}
}
The schema is an array of objects that defines the kind of data stored in the model and how the entry form should be laid out. A schema is fluid by default so you can add any number or fields in any arrangement. However it is possible to created a fixed schema so a given Document has an enforced schema.
[
{
"type": "content",
"model": "content1",
"label": "Body Content",
"instructions": "Enter some content here.",
"options": {}
}
]
Templates are field type that groups together multiple other fields.
[
{
"type": "template",
"model": "content1",
"template": {
"fields": [
{
"type": "content",
"model": "content1"
},
{
"type": "media",
"model": "media1"
}
]
}
}
]
Or you can use a globally defined template
[
{
"type": "template",
"model": "content1",
"template": "contentWithImage"
}
]
A replicating field set allows you to add multiple instances of a set of fields.
[
{
"type": "template",
"model": "socialLinks",
"template": {
"replicator": true,
"sets": [
{
"display": "Social Link",
"fields": {
"url": {
"type": "text",
"model": "url",
"placeholder": "Social profile URL"
}
}
}
]
}
}
]
Users can be restricted to specific areas of content.
{
"permissions": {
"filesRootDirectory": "subdirectory",
"groupRootId": 2
}
}