updating previous content to HasDrafts #30
-
I have content already in the database and would like to add laravel-drafts but I can't see a way to update the old content. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @retosteffen, Thanks for the suggestion. It's a bit tricky to do since there's no way of knowing what the publisher should be automatically. Your best bet is to set the data manually in the database if you know what you want the values to be. Model::query()->whereNull('uuid')->each(function (Model $record): void {
$record->generateUuid();
$record->save();
}); |
Beta Was this translation helpful? Give feedback.
Hi @retosteffen,
Thanks for the suggestion. It's a bit tricky to do since there's no way of knowing what the publisher should be automatically. Your best bet is to set the data manually in the database if you know what you want the values to be.
Regarding the uuid, you can fill them in for existing models like this: