Closed jacksleight closed 5 months ago
@ryanmitchell PR for supporting the preview tokens as we talked about. :)
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).
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.
Cool, will do. Thanks!
All looks good to me, but I'll let Jason merge it as he was working with you on this.
Adds token support so live preview tokens are stored in the database.
There are a couple of things that are out of the ordinary:
TokenRepository
contract, so we're just binding to the file repository class instead.make
method doesn't use the service container, so we have to override it.app(Token::class)::fromModel($model)
doesn't work due to the constructor arguments, so this just callsToken::fromModel($model)
directly.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.