Draftable/Core Status UtilitiesCreated 2 years ago by ryanthompson
I often find the need to save any random entry as a draft. Custom addons and core alike. Some core addons like Pages and Posts handle it custom per their own API. But to do so requires that you build it yourself each time.
I propose a core status utility. Where we can define status groups (with a default) and some simple rules like hiding them from queries.
The simplest form of this would be "draftable" for example. Similar to
trashable it would simply be a flag and
draft boolean would be added to the table and drafts omitted from queries unless
withDrafts is included. Very similar to
I am OK with fixing options too - I thought perhaps we'd use config for statuses / groups if not using a single
draftable approach. I forsee again banks / larger entities wanting to have draft, ready for review, approved, type workflow and simple
draftable would not accommodate that. Personally I am in favor of the config status definitions and perhaps detect draft and perhaps some others automatically to prevent them from being in queries unless
withStatus('draft')->withStatus('pending') for example.