Changelog

Release notes your admins write, with a category and a publish date, sanitised on save and published at /changelog, grouped by month with a category filter.

The public changelog: a row of category filter links with counts, then entries grouped under month headings, each with a category badge, its date, title and body
/changelog, signed out.

What it adds

FilePurpose
app/Models/ChangelogEntry.phpulid, title, HTML body, category, published_at, is_published; published() scope, categories()
database/factories/ChangelogEntryFactory.phpFactory with a draft() state
database/migrations/*_create_changelog_entries_table.php
app/Livewire/Changelog/PublicChangelog.php and its viewThe public page, in the user shell
app/Livewire/Admin/Changelog/ChangelogList.php, ChangelogForm.php and viewsList, create and edit

Install

php artisan ui-kit:install-module changelog

Composer: mews/purifier:^3.4, which sanitises the HTML body on save.

What the installer changes

  • Publishes the purifier config.
  • Adds /changelog between the public-routes markers in routes/ui-kit-user.php, the group open to guests, three routes between the markers in routes/admin.php, and a Changelog nav entry in config/admin.php.
  • Runs the migration.

Routes

RouteName
GET /changelogchangelog.public
GET /admin/changelogadmin.changelog.index
GET /admin/changelog/createadmin.changelog.create
GET /admin/changelog/{ulid}/editadmin.changelog.edit

The public page

/changelog lists the published entries, newest first, under a heading per month. published() filters on is_published and a published_at of today or earlier, so a scheduled entry appears on its date and a draft never does. Each entry shows its category badge (colours from ChangelogEntry::categoryTone()), its date, its title and its body.

The category filter above the list is a row of links, ds::tabs in navigation mode, each with its count: All, then every category with at least one published entry. Each link is its own URL (/changelog?category=fix), so a filtered view can be shared or bookmarked, and the current one is marked with aria-current. The counts come from one grouped query. An unknown category in the URL shows everything. With nothing published, the page says so.

The body is printed as HTML. That is safe because the admin form runs it through mews/purifier on save, keeping only p, br, strong, b, em, i, u, ul, ol, li, a[href], h3 and h4; an entry written some other way (a seeder, an import) has to be purified the same way. The categories, and their labels, are ChangelogEntry::categories().

The shell's header shows a Changelog link on every user-facing page while the route exists.

The admin screens

The changelog list: a title search and category filter over a table of entries with category and status badges
/admin/changelog, with a draft entry at the top.

The list opens with a New Entry button in the page header, then a title search and a category filter over a table: title, a category badge, a Published or Draft badge, the date, and Edit and Delete per row.

The changelog entry form with title, category, body, publish date and the Published switch
Create and edit share one form component. The Published switch is saved with the form.

The form has title, category, an HTML body (the allowed tags are listed under it), a publish date and a Published switch. The switch is bound to the form like every other field: nothing is published until you press Create Entry or Save.

Removing

Delete the model, factory, Livewire components and views, remove the route lines from routes/ui-kit-user.php and routes/admin.php and the nav entry between their markers, drop changelog_entries, remove changelog from installed_modules, and composer remove mews/purifier if nothing else uses it.

Was this page helpful?