fof/drafts
FoF Drafts adds draft support to Flarum, letting users save discussions and posts as private drafts and return to finish them later. Drafts stay visible only to their author, with sensible permissions and seamless integration into the composer workflow.
composer require fof/drafts, enable it under Admin → Extensions, then run php flarum migrate and php flarum cache:clear from the forum root. Flarum is not a full Laravel app (it uses Illuminate database/events/validation under the hood), so use the flarum CLI, not artisan.extend.php (which controllers, policies, model defaults, and listeners are registered), migrations/ (the authoritative schema — column names like is_draft, plus any scheduled-publish columns), src/ (policies and event listeners), and js/src/forum/ (composer autosave and draft-list UI).DiscussionStarted notifications.select id, user_id, is_draft, created_at from discussions order by id desc limit 5; — that tells you what the extension actually persists far faster than reading the JS.Discussion model and add where('is_draft', false) to any query that feeds a public surface. Don't invent a parallel Draft model.POST /api/discussions on first save, then PATCH the same id on subsequent saves. Keep the draft id in composer state so a page refresh or a second tab doesn't create duplicates.Discussion\Saving / Created / Started and bail early when $discussion->is_draft is true. Notifications, activity entries, webhooks, search indexing, and external syncs should all treat drafts as invisible.(new Extend\Event())
->listen(DiscussionStarted::class, function (DiscussionStarted $event) {
if ($event->discussion->is_draft) {
return; // don't broadcast/index/notify for drafts
}
// normal publish-time work
}),
discussion.start / discussion.edit where possible. If you need a "may create drafts" ability, add it via a policy extender and expose the same boolean as a forum attribute so the frontend can hide the save button consistently.php flarum schedule:run and a queue:work worker; otherwise scheduled drafts sit unpublished indefinitely and look like a bug.DiscussionComposer for a save-draft button, DiscussionListItem for a badge, and a route or filter for "my drafts" rather than making users scroll the main list.@mentions inside an unpublished draft can notify people before it's published. Test by saving a draft containing a mention and inspecting the recipient's notification list.start_time are set at save or at publish. Check the migration before using them for sorting or permalinks — a draft with a real slug can be reached by URL if your policy check is missing.composer.json, read the migration diff before php flarum migrate, and re-run save → resume → publish → (schedule) after every upgrade.php flarum cache:clear after any settings change, check storage/logs/flarum-*.log, and replay the failing autosave with curl against /api/discussions — that separates composer/frontend bugs from policy 403s quickly.How can I help you explore Laravel packages today?