NewWe open-sourced 50+ Laravel packages
Custom AI apps, agents and automation — Roundly ConsultingRoundly
All packages
Posts for Laravel

Installation

Require the package with Composer. The service provider is auto-discovered, and the packages Posts builds on — package-toolkit, enums, sluggable, media-library, likes, reports and approvals — install as dependencies and auto-discover too:

composer require roundly-consulting/posts-for-laravel

Migrations are publish-only: nothing is auto-loaded, so a bare php artisan migrate creates no tables until you publish them. Choose your key types first (see Key types) — the author column and the posts ids are typed when the migration runs:

php artisan vendor:publish --tag="posts-migrations"

# The packages posts builds on are publish-only too:
php artisan vendor:publish --tag="media-migrations"
php artisan vendor:publish --tag="likes-migrations"
php artisan vendor:publish --tag="reports-migrations"
php artisan vendor:publish --tag="approvals-migrations"

# Only if you turn on slug history (posts.slugs.history):
php artisan vendor:publish --tag="sluggable-migrations"

php artisan migrate

Slug indexes and locales

The posts, categories and tags migrations add one unique index per supported locale on slug. The locale list comes from sluggable-for-laravel — sluggable.locales.supported, or translatable-for-laravel’s locales when it is installed, else app.locale + app.fallback_locale — so set it before migrating. Locales you add later get their indexes with:

php artisan sluggable:indexes "RoundlyConsulting\Posts\Models\Post"
php artisan sluggable:indexes "RoundlyConsulting\Posts\Models\Category"
php artisan sluggable:indexes "RoundlyConsulting\Posts\Models\Tag"

On SQL Server, which sluggable cannot index, the index step is skipped and slug uniqueness stays application-level — the install does not abort. On PostgreSQL the translatable columns ship as jsonb and the slug indexes are expression indexes on slug->>'<locale>', so slug lookups and route binding use them.

Config and views

Both are optional. Publish the config to change defaults, and the views to restyle the rendered meta tags and JSON-LD:

php artisan vendor:publish --tag="posts-config"
php artisan vendor:publish --tag="posts-views"

The package’s publish tags are posts-config, posts-migrations and posts-views.

Show your open-source love

This package is free and MIT-licensed. If it saves you time, a one-off donation or a Patreon membership keeps it maintained, tested and documented.

More ways to support, including crypto

By donating, you agree to our donation terms.

Want this built into your product?

We integrate our packages into custom Laravel and AI builds. Tell us what you're working on and we'll reply within 48 hours.