statamic / eloquent-driver

Provides support for storing your Statamic data in a database, rather than flat files.
https://statamic.dev/tips/storing-content-in-a-database
MIT License
104 stars 74 forks source link

Tokens support #277

Closed jacksleight closed 5 months ago

jacksleight commented 5 months ago

Adds token support so live preview tokens are stored in the database.

There are a couple of things that are out of the ordinary:

These probably require PRs to core if we want them to work like everything else.

Let me know if anything needs changing.

The new update script assumes this will be in 3.5.0.

SylvesterDamgaard commented 5 months ago

@ryanmitchell PR for supporting the preview tokens as we talked about. :)

ryanmitchell commented 5 months ago

Awesome, thanks for this.

I've added a PR to core for the cli install support: https://github.com/statamic/cms/pull/9962

We're switching to default repositories file rather than eloquent from the next release, so I've gone ahead and changed that in advance of that. You can just run the migration manually anyway, and opt-in (which is what I would expect on our installs).

jasonvarga commented 5 months ago

There's no TokenRepository contract, so we're just binding to the file repository class instead.

This was dumb on my part. Since this PR is targeting Statamic 5, we can get a contract into core that you can bind to.

jacksleight commented 5 months ago

Cool, will do. Thanks!

ryanmitchell commented 5 months ago

All looks good to me, but I'll let Jason merge it as he was working with you on this.