Introduction
Last updated:
On this page
Post Types
Post Types brings WordPress-style post types to Laravel. You define a kind of post (news, events, pages, jobs) in a few lines, and the package gives it:
- storage: one
poststable for every post type, with a title, slug, excerpt, block-editor content, a status, a publish date and an author; - taxonomies: categories, tags or your own, shared between post types, flat or hierarchical;
- statuses and scheduling: draft, pending review and published (and your own); a published post with a future publish date is scheduled and appears on its own;
- meta fields with javaabu/meta, media with javaabu/mediapicker and content with javaabu/block-editor;
- admin pages with javaabu/filters and javaabu/bulk-actions, in Blade or Inertia React;
- public pages: an archive, term archives and single posts, with permalinks you configure and templates you override;
- permissions per post type through javaabu/permissions, for any guard and user model.
use Javaabu\PostTypes\Facades\PostTypes;
use Javaabu\PostTypes\PostType;
use Javaabu\PostTypes\Taxonomy;
use Javaabu\Stencil\Fields\Checkbox;
use Javaabu\Stencil\Fields\TextInput;
// AppServiceProvider::boot()
PostTypes::taxonomy(Taxonomy::make('categories')->labels('Category', 'Categories')->hierarchical());
PostTypes::register(
PostType::make('news')
->labels('News article', 'News')
->supports(['content', 'excerpt', 'media', 'meta', 'author', 'scheduling'])
->taxonomies(['categories'])
->metaFields([
TextInput::make('subtitle')->maxLength(255),
Checkbox::make('featured'),
])
->permalink('{year}/{month}/{slug}')
);
// routes/web.php
Route::middleware('web')->group(function () {
Route::postTypesAdmin(['guard' => 'web_admin', 'prefix' => 'admin', 'name' => 'admin.']);
Route::postTypes();
});
That's /admin/news for admins (list, filter, create, edit, publish, trash), /admin/taxonomies/categories for the categories, and /news, /news/categories/{term} and /news/2026/11/{slug} for visitors.
What's included
- Definitions:
PostType,TaxonomyandStatus, fluently or as classes. See Defining post types and Taxonomies and statuses. - Meta, media and content: see Meta, media and content.
- Admin pages: see Admin pages.
- Public pages and permalinks: see Public pages and Permalinks.
- Permissions: see Permissions.
- Translations: optional, with javaabu/translatable. See Translations.
- Menus: posts and archives as menu items, with javaabu/dynamic-menubuilder. See Menus.
- Dhivehi and RTL: see Dhivehi and RTL.