Eloquent Driver

A package that allows you to store Statamic entries in a database.
Alternatives To Eloquent Driver
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Avbook8,777
7 months ago85PHP
AV 电影管理系统, avmoo , javbus , javlibrary 爬虫,线上 AV 影片图书馆,AV 磁力链接数据库,Japanese Adult Video Library,Adult Video Magnet Links - Japanese Adult Video Database
Aimeos Laravel6,4892514 days ago126January 24, 20233mitPHP
Laravel ecommerce package for ultra fast online shops, scalable marketplaces, complex B2B applications and #gigacommerce
Laravel Tips5,844
19 days ago1
Awesome tips for Laravel
Laravel Backup5,3306991308 days ago278August 09, 20232mitPHP
A package to backup your Laravel app
Database2,59713,6076,5124 days ago707August 08, 2023mitPHP
[READ ONLY] Subtree split of the Illuminate Database component (see laravel/framework)
Laravel Translatable1,9753491364 years ago44June 03, 2019mitPHP
[Deprecated] A Laravel package for multilingual models
Pingcrm1,872
a month ago26mitPHP
A demo application to illustrate how Inertia.js works.
Backup Manager1,626275148 months ago43July 05, 202214mitPHP
Database backup manager for dumping to and restoring databases from S3, Dropbox, FTP, SFTP, and Rackspace Cloud
Laravel Tags1,482643022 days ago69July 31, 20233mitPHP
Add tags and taggable behaviour to your Laravel app
Prequel1,445214 months ago12February 28, 20224mitJavaScript
Prequel for Laravel. Clear and concise database management.
Alternatives To Eloquent Driver
Select To Compare


Alternative Project Comparisons
Readme

Statamic Eloquent Driver

This package provides support for storing your Statamic data in a database rather than the filesystem.

Installation

Install using Composer:

composer require statamic/eloquent-driver

Publish the config file:

php artisan vendor:publish --tag="statamic-eloquent-config"

Since Statamic uses UUIDs within content files by default, we provide two solutions depending on whether you need to use existing content.

Fresh install of statamic/statamic (using incrementing ids)

If you're starting from scratch, we can use traditional incrementing integers for IDs.

  • Delete content/collections/pages/home.md
  • Change the structure tree in content/trees/collections/pages.yaml to {}.
  • Run php artisan vendor:publish --provider="Statamic\Eloquent\ServiceProvider" --tag=migrations.
  • Run php artisan vendor:publish --tag="statamic-eloquent-entries-table".
  • Run php artisan migrate.

Starting from an existing site (using UUIDs)

If you're planning to use existing content, we can use the existing UUIDs. This will prevent you from needing to update any data or relationships.

  • In the config/statamic/eloquent-driver.php file, change entries.model to \Statamic\Eloquent\Entries\UuidEntryModel::class.
  • Run php artisan vendor:publish --provider="Statamic\Eloquent\ServiceProvider" --tag=migrations.
  • Run php artisan vendor:publish --tag="statamic-eloquent-entries-table-with-string-ids".
  • Run php artisan migrate.

Configuration

The configuration file (statamic.eloquent-driver) allows you to choose which repositories you want to be driven by eloquent. By default, all are selected, but if you want to opt out simply change driver from eloquent to file for that repository.

You may also specify your own models for each repository, should you wish to use something different from the one provided.

Upgrading

After upgrading please ensure to run php artisan migrate to update your database to the latest schema.

Importing existing file based content

We have provided imports from file based content for each repository, which can be run as follows:

  • Assets: php please eloquent:import-assets
  • Blueprints and Fieldsets: php please eloquent:import-blueprints
  • Collections: php please eloquent:import-collections
  • Entries: php please eloquent:import-entries
  • Forms: php please eloquent:import-forms
  • Globals: php please eloquent:import-globals
  • Navs: php please eloquent:import-navs
  • Revisions: php please eloquent:import-revisions
  • Taxonomies: php please eloquent:import-taxonomies

Exporting back to file based content

We have provided exports from eloquent to file based content for each repository, which can be run as follows:

  • Assets: php please eloquent:export-assets
  • Blueprints and Fieldsets: php please eloquent:export-blueprints
  • Collections: php please eloquent:export-collections
  • Entries: php please eloquent:export-entries
  • Forms: php please eloquent:export-forms
  • Globals: php please eloquent:export-globals
  • Navs: php please eloquent:export-navs
  • Revisions: php please eloquent:export-revisions
  • Taxonomies: php please eloquent:export-taxonomies

Storing Users in a Database

Statamic has a built-in users eloquent driver if you'd like to cross that bridge too.

Mixed driver entries and collections

This driver does not make it possible to have some collections/entries file driven and some eloquent driven. If that is your requirement you may want to look into using Runway.

Popular Database Projects
Popular Laravel Projects
Popular Data Storage Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Php
Database
Laravel
Driver
Cms
Ids