feat(knowledge-base): article + category authoring subsystem - #122
Merged
Conversation
Port the knowledge-base authoring feature from the Laravel reference so KB content can be authored, stored, and served. - Migration 0062 creates escalated_article_categories and escalated_articles (slug, status, publish/view/feedback counters, self-referencing category tree, author + category FKs). - Lucid models Article and ArticleCategory with published/draft/search and roots/ordered scopes, atomic view/feedback counters, slug hooks. - Admin CRUD controllers for articles (index/create/store/edit/update/ destroy) and categories (index/store/update/destroy) plus routes and i18n flash messages. - Wire the public widget read path to real data: list/search published articles and fetch a published article by slug (was a stub). - Shared pure helpers in support/knowledge_base.ts (slug, publish semantics, public read selection) covered by unit tests proving admin create to public list/show, draft exclusion, and category filtering.
mpge
added a commit
that referenced
this pull request
Aug 2, 2026
Port the knowledge-base authoring feature from the Laravel reference so KB content can be authored, stored, and served. - Migration 0062 creates escalated_article_categories and escalated_articles (slug, status, publish/view/feedback counters, self-referencing category tree, author + category FKs). - Lucid models Article and ArticleCategory with published/draft/search and roots/ordered scopes, atomic view/feedback counters, slug hooks. - Admin CRUD controllers for articles (index/create/store/edit/update/ destroy) and categories (index/store/update/destroy) plus routes and i18n flash messages. - Wire the public widget read path to real data: list/search published articles and fetch a published article by slug (was a stub). - Shared pure helpers in support/knowledge_base.ts (slug, publish semantics, public read selection) covered by unit tests proving admin create to public list/show, draft exclusion, and category filtering. Co-authored-by: Matt Gros <mpge@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Ports the knowledge-base authoring subsystem from the Laravel reference. KB was a stub (empty article list, 404 detail, no tables/models). This adds authoring, storage, and a working public read surface.
Changes
Schema —
database/migrations/0062_create_escalated_knowledge_base_tables.tsescalated_article_categories: name, unique slug, self-referencingparent_id(SET NULL), position, description.escalated_articles: category FK (SET NULL), title, unique slug, longtext body, status (draft/published), hostauthor_id, view/helpful/not-helpful counters,published_at,[status, published_at]index.Models —
src/models/article.ts,src/models/article_category.tspublished/draft/searchandroots/orderedscopes,category/parent/children/articlesrelations, atomicincrementViews/markHelpful/markNotHelpful, slug-on-create hooks.Admin CRUD —
admin_articles_controller.ts(index/create/store/edit/update/destroy),admin_article_categories_controller.ts(index/store/update/destroy), routes under/admin/kb/*, andadmin.article_*/admin.article_category_*flash strings. Mirrors the automation/canned-responses admin controllers.Public read —
src/controllers/widget_controller.tsGET /widget/articlesnow lists/searches published articles;GET /widget/articles/:slugreturns a published article by slug (increments views, includes related). Previously stubs.Shared logic —
src/support/knowledge_base.tsTests
tests/unit/knowledge_base.spec.ts(TDD, written first) proves: admin-created published articles appear in the public list/show; unpublished (draft) articles are excluded from list and show-by-slug; category assignment filtering; slug + publish-timestamp semantics; case-insensitive search.--testtests + 21 Japa tests, 0 failures. No regressions.tsc --noEmitclean; ESLint clean on all touched files.Notes
Lint flags 3 pre-existing files outside this diff (
import_job.ts,newsletter/newsletter_delivery.ts,validators/admin/skill_payload.ts) under the local prettier build; left untouched — only the files in this PR were formatted against the locked version.