Note
From an empty Laravel app to a blog admin with login
One session, one empty Laravel app, one coding agent working from the docs: a blog admin with posts, tags, a dashboard and sign-in. Here is every place it got stuck.
Quick-start guides are usually written after the fact, by someone who already knows where every trap is. This one wasn't.
We started from an empty Laravel app and built a small blog admin on tbtop/admin 0.7 in one session, keeping a build log as we went: posts with a rich-text body, a cover image and a draft/published status, plus categories, tags, authors, a dashboard and a sign-in screen. Everything below comes from that project: the code is the demo repo's, and the stumbles are the build log's.
One thing up front: the session was driven by a coding agent (Cursor), with nothing but the tbtop docs and the reference app to go on. That is part of the point. If an agent can get from an empty app to a working admin that way, so can you. Where it got stuck, we say so, because those spots are the useful part.
If you only skim, these are the four places it got stuck:
- PHP 8.4, not 8.3.
- Register a panel before
admin:install --auth. - Build the frontend before you open
/admin. - Habits from other admin packages:
counts()and a many-to-manyrelation()don't exist here.
PHP 8.4 first
tbtop/admin ^0.7 requires PHP 8.4. A fresh Ubuntu image often ships only 8.3, and then composer require simply fails. The full list is in the requirements table. Here's what we ran:
sudo add-apt-repository -y ppa:ondrej/php
sudo apt-get install -y php8.4-cli php8.4-xml php8.4-mbstring php8.4-curl php8.4-zip php8.4-sqlite3 php8.4-gd php8.4-intlphp8.4-gd is optional. Without it, uploaded images are still stored, you just get no thumbnails.
A fresh Laravel app and the packages
composer create-project installs the same skeleton as laravel new without a starter kit, which is all we need:
composer create-project laravel/laravel laravel-blog
cd laravel-blog
composer require tbtop/admin:^0.7 inertiajs/inertia-laravel:^3.1 laravel/sanctum:^4.3 tightenco/ziggy:^2.4
composer require laravel/mcp:^1.0 # optional, for the MCP endpointlaravel/mcp and Sanctum are only there for the MCP bonus at the end. Skip them if you don't want it.
Register a panel before asking for auth
This is the step that took the most thought.
tbtop/admin can scaffold the sign-in pages with php artisan admin:install --auth, but only once a panel exists. Run it first and it stops:
No panel registered: add one to tbtop-admin.panels before --auth.Which is fair once you know what a panel is: the class that owns the prefix, the guard and the pages. The sign-in pages need to know which panel they belong to. Since 0.7.1 the installer also prints the line to add and a link to the panel docs. The order is: publish the config and the host wiring first,
php artisan vendor:publish --tag=tbtop-admin-config
php artisan admin:installthen register the panel in config/tbtop-admin.php:
'panels' => [
\App\Admin\AdminPanel::class,
],Here's the panel the blog ended up with:
use Tbtop\Admin\Navigation\NavGroup;
use Tbtop\Admin\Panels\Panel;
use Tbtop\Admin\Panels\PanelConfig;
class AdminPanel extends Panel
{
public function configure(PanelConfig $panel): PanelConfig
{
return $panel
->id('admin')
->prefix('admin')
->guard('web')
->middleware(['web'])
->pages([
DashboardPage::class,
])
->discoverPages(
in: app_path('Admin/Pages'),
for: 'App\\Admin\\Pages',
)
->navigationGroups([
NavGroup::make('Overview')->icon('home'),
NavGroup::make('Content')->icon('file-text')->collapsible(),
])
->rootView('admin')
->mcp(['auth:sanctum', 'abilities:tbtop-mcp']);
}
}Three things went wrong before this booted. Each is a one-liner once you know it:
app/Admin/Pages/has to exist. Page discovery throws if the directory is missing. After a failed half-setup there was also a stale discovery index;php artisan tbtop:clear-cached-pagescleared it.NavGrouplives inTbtop\Admin\Navigation, notTbtop\Admin\Panels. When in doubt, copy imports from the reference app, which Composer puts atvendor/tbtop/admin/apps/demo/.->rootView('admin')matters. Without it, admin pages render through your app's main layout and load the wrong bundle.
Now the auth scaffold goes through:
php artisan admin:install --authIt publishes three empty subclasses into app/Admin/Pages/Auth/: LoginPage, ForgotPasswordPage and ResetPasswordPage. They really are empty. The behaviour lives in the package base class, so fixes arrive with composer update:
class LoginPage extends \Tbtop\Admin\Auth\LoginPage {}Don't skip the step the installer prints. It tells you to send guests to the panel's login page, and it doesn't do it for you. Without it, a guest opening/admingets a 500, because Laravel looks for a route namedlogin.
->withMiddleware(function (Middleware $middleware): void {
$middleware->redirectGuestsTo(
fn (): string => \Tbtop\Admin\Auth\LoginPage::currentUrl() ?? '/admin/login',
);
})Hooks such as credentials() and afterAuthenticated() (for a second factor, say) and the password broker are covered in Authentication.
Frontend: the admin gets its own entry
The admin is an Inertia + React client with its own Vite entry, view and stylesheet, so your public pages never load the admin bundle. admin:install already published resources/js/admin.tsx, resources/css/admin.css and resources/views/admin.blade.php. What's left is the client package and Vite:
npm install @tbtop/inertia-admin@0.7.1 react@^19 react-dom@^19 @inertiajs/react@^3.3 @vitejs/plugin-react@^6Keep the npm version equal to the Composer one: the two packages ship in lockstep. Our run installed @vitejs/plugin-react@4, which conflicts with Vite 8's peer range and needed --legacy-peer-deps. You can skip that workaround: the Install page now pins @vitejs/plugin-react@^6 for Vite 8, which installs cleanly.
export default defineConfig({
plugins: [
laravel({
input: ['resources/css/app.css', 'resources/js/admin.tsx'],
refresh: true,
}),
react(),
tailwindcss(),
],
});Then build:
npm run buildThis is the most common reason a fresh panel "doesn't work". Admin pages return a 500 until there's a built manifest or npm run dev is running.The Install page has the full Vite config, including resolve.dedupe and the 404 page component.
The domain
Nothing tbtop-specific here, and that's the point: it's plain Laravel. One migration for posts, categories, tags and a post_tag pivot, a PostStatus enum (draft / published), three models and seeders. The media-library migrations ship inside the package and run with your normal migrate:
php artisan migrate --seed
php artisan storage:linkThe seeder creates the demo admin you'll sign in with:
User::query()->firstOrCreate(
['email' => 'admin@blog.demo'],
[
'name' => 'Demo Admin',
'password' => Hash::make('password'),
],
);Admin pages
Here's the part that feels different if you come from Filament or Nova.
In tbtop, an admin screen is one PHP class per route under app/Admin/Pages/, and the panel discovers them. There's no runtime resource class behind them. You write a page's view() and compose tables, forms, stats and actions in it. More explicit, and every screen is exactly what you wrote. Since 0.7.1, php artisan make:tbtop-resource Post writes a list, create and edit page from the table as a starting point; the blog's pages were written by hand before it existed. Seven small page classes:
DashboardPageat/admin/dashboardPostsIndexPageat/admin/postsPostCreatePageat/admin/posts/newPostEditPageat/admin/posts/{post}/editCategoriesIndexPageat/admin/categoriesCategoryEditPageat/admin/categories/{category}/editTagsIndexPageat/admin/tags
Dashboard
A grid of Stat blocks and a couple of links. Each stat is about this long:
Stat::make('Published')
->value(fn () => Post::query()->where('status', PostStatus::Published)->count())
->description('Live on the blog')
->icon('globe')
->color(Color::Success)
->toNode(),The posts table
PostsIndexPage is the biggest file in the project, and it packs a lot: search, sorting, a status filter, an author filter with type-ahead, All / Published / Draft tabs, a per-row publish toggle and a bulk publish. The columns:
Column::make('title')->label('Title')->searchable()->sortable(),
Column::make('slug')->label('Slug')->copyable(copyMessage: 'Slug copied'),
Column::make('status')->label('Status')
->badge([
PostStatus::Published->value => ['label' => 'Published', 'color' => Color::Success],
PostStatus::Draft->value => ['label' => 'Draft'],
]),Actions are where tbtop's model clicks. An action is a closure that returns effects: what the UI should do next. No client code, no API endpoint to write. Here's the row toggle:
$s->action('togglePublish')->label('Publish / unpublish')->handle(
function (ActionCtx $ctx): Effects {
$post = Post::query()->whereKey($ctx->key())->firstOrFail();
$published = $post->status !== PostStatus::Published;
$post->update([
'status' => $published ? PostStatus::Published : PostStatus::Draft,
'published_at' => $published ? ($post->published_at ?? now()) : null,
]);
return Effects::make()
->notify($published ? 'Post published' : 'Post unpublished')
->refreshTable('posts');
},
needs: ['row'],
),A bulk action is the same shape with needs: ['selection'], reading $ctx->selection instead of the row key.
The full set of column, filter and effect methods is in Tables and Actions.
One form, two pages
Create and edit share their fields through a small trait, PostFormFields. The interesting ones:
$s->slug('slug')->label('Slug')->required()
->fromField('title')
->rules(['max:200', 'regex:/^[a-z0-9-]+$/', $slugUniqueRule]),
$s->richtext('body')->label('Body')->placeholder('Write the post…'),
$s->media('cover_media_id')->label('Cover image')
->accept(['image/*'])
->rules('nullable|integer'),
$s->relation('category_id')->label('Category')
->query(fn () => Category::query()->orderBy('name'))
->labelKey('name')
->searchable()
->rules('nullable|exists:categories,id'),
$s->date('published_at')->label('Published at'),Validation is plain Laravel rules on the field, and the same rules run on the server.
The edit form is filled from $post->toArray(), which gives published_at as a full timestamp. On 0.7.0 that left the date field empty, and saving the form cleared the date. Since 0.7.1 the field trims a timestamp to its day by itself; on 0.7.0, pass $post->published_at?->toDateString().
Tags needed thought. relation() covers belongs-to (category, author) and holds one key. For the many-to-many tags we used a multi-select and synced the pivot on save ourselves:
$s->select('tag_ids')->label('Tags')->multiple()
->options(Tag::query()->orderBy('name')->get()
->map(fn (Tag $tag): array => ['value' => (string) $tag->id, 'label' => $tag->name])
->all())
->rules('nullable|array|exists:tags,id'),On a multiple select, tbtop splits the rules for you: array applies to the list, exists:tags,id to each id. The edit page's submit handler takes tag_ids out of the form, updates the post and syncs:
->onSubmit(function (ActionCtx $ctx): Effects {
$post = Post::findOrFail($ctx->params['post'] ?? null);
$form = $ctx->form;
unset($form['tag_ids']);
$post->update($form);
$post->tags()->sync(array_map('intval', $ctx->form['tag_ids'] ?? []));
return Effects::make()->notify('Saved');
}),The docs have this as a ready recipe, with a server-side search for long tag lists: Many-to-many.
Categories: a create modal and a count column
CategoriesIndexPage uses CreateAction for a "New category" modal on the table header.
One trap here came straight from habit. We first wrote Column::make('posts_count')->counts('posts'), and there's no counts() in tbtop. You don't need one: the table takes an Eloquent query, so withCount() plus a plain column does it.
->query(fn () => Category::query()->withCount('posts'))
->columns([
Column::make('name')->label('Name')->sortable(),
Column::make('posts_count')->label('Posts')->align('right')->sortable(),
])Counting a relation in the Tables docs covers what sorts and what doesn't.
Before you ship it
This is a demo, and two things in it are deliberately minimal:
- Anyone who can sign in is an admin. The panel only checks
authon thewebguard. A real app should add a gate (can:access-admin) or a separate guard; see Access control. - Deploy steps, such as caching the page discovery index, are in Deploy.
Run it yourself
composer install
cp .env.example .env && php artisan key:generate
touch database/database.sqlite
php artisan migrate --seed
php artisan storage:link
npm install
npm run build
php artisan serveSign in at http://127.0.0.1:8000/admin with admin@blog.demo / password.
Bonus: let Claude or Cursor work in the admin
Since 0.6, a panel can serve an opt-in MCP endpoint. An AI client can search the pages it's allowed to open, query their tables, and execute their actions and forms. It does this signed in as one of your users, with the same gates and validation as the UI. No second API to secure.
In the demo, it's the one line in the panel you saw above:
->mcp(['auth:sanctum', 'abilities:tbtop-mcp']);The User model also gets Sanctum's HasApiTokens trait. With laravel/mcp installed, that registers POST /admin/mcp. To finish the wiring:
- register Sanctum's
abilitiesmiddleware alias inbootstrap/app.php; - issue a token with the
tbtop-mcpability, as below. The package doesn't issue tokens; your app does; - repeat any panel-wide access check in the
mcp()list, because panel middleware doesn't run on the MCP route.
$user->createToken('Claude', ['tbtop-mcp'])->plainTextToken;Before wiring a client, check the endpoint with one curl, as Check it locally shows. Then give your client the URL and a bearer header:
{
"mcpServers": {
"tbtop-blog-demo": {
"url": "http://127.0.0.1:8000/admin/mcp",
"headers": {
"Authorization": "Bearer YOUR_SANCTUM_TOKEN"
}
}
}
}That URL-plus-header shape is what HTTP MCP clients such as Cursor take. Claude Code takes claude mcp add --transport http …. Claude Desktop only starts local servers, so the docs bridge it with mcp-remote. All three are on the MCP page.
A word on safety. tbtop marks execute as destructive, because actions are your code and the package can't tell a delete from an edit. Whether the user is asked to confirm is up to the MCP client; tbtop adds no confirmation of its own. Hide actions an agent should never run with ->mcp(false).
The follow-up post runs a real task through these tools on this blog admin, and goes through what keeps the agent inside its user's rights.
Wrap-up
A working blog admin with sign-in, built in one session.
Looking back at the build log, the friction was all one-time setup: the PHP version, registering the panel before --auth, building the frontend, and a couple of API guesses carried over from other admin packages. None of it comes back on the second project, and two of those spots are smoother since 0.7.1. After that, it was just writing page classes.
- Demo repo and full build log: DiVotek/tbtop-blog-demo
- Docs: docs.tbtop.dev
- Reference app: demo.tbtop.dev