https://github.com/statamic/eloquent-entries-example
An example package that allows you to store Statamic entries in a database.
https://github.com/statamic/eloquent-entries-example
Last synced: 3 months ago
JSON representation
An example package that allows you to store Statamic entries in a database.
- Host: GitHub
- URL: https://github.com/statamic/eloquent-entries-example
- Owner: statamic
- Created: 2020-09-09T14:15:59.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-04-20T14:01:44.000Z (about 2 years ago)
- Last Synced: 2025-03-22T04:41:25.775Z (3 months ago)
- Language: PHP
- Homepage:
- Size: 14.6 KB
- Stars: 6
- Watchers: 6
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Statamic Eloquent Entries Example
> ⚠️ This repository is intended to be a learning tool, and not used in production.
[This is built in a walkthrough on the Statamic Knowledge Base](https://statamic.dev/knowledge-base/storing-entries-in-a-database).
A package intended for real usage exists at [statamic/eloquent-driver](https://github.com/statamic/eloquent-driver).
## Installation
- Clone or download this repository.
- Add a repository in your project's `composer.json` pointing to where you cloned it:
``` json
"repositories": [
{
"type": "path",
"url": "path/to/repo"
}
]
```
- Require it with `composer require statamic/eloquent-entries-example`
- Run migrations with `php artisan migrate`## Schema
Most of the entries' blueprint fields are in a catch-all JSON `data` column. This allows us to not need to update the DB schema when you change the blueprint.
The `id` and `origin_id` columns are strings, to make migrating from files easier. If they were incrementing integers, you'd need to update anywhere the IDs
are referenced. Relationship field values, collections' mount values, structures, etc.