# Add a Blog Dashboard to a Filament Admin Panel from a Linear Issue

Yes. An agent adds a dashboard page with stats, chart and table widgets for posts and comments, following the panel's own patterns, tests each one, and opens a PR.

[Run this on Rush](https://cloud.getrush.ai/run/add-blog-dashboard/filament/). Opens the console with this prompt ready to send, in a Project that has your repository.

## What the agent does

The agent reads how the panel already builds dashboards. In an admin shaped like filamentphp/demo, `composer.json` pins `filament/filament` at ^5.0 on `laravel/framework` ^12 with `pestphp/pest` ^3, `larastan/larastan` and `laravel/pint`, and its `test` script runs `pest --parallel` then `phpstan analyse` at level 8 over `app/`. `app/Providers/Filament/AdminPanelProvider.php` discovers pages under `app/Filament/Pages` and widgets under `app/Filament/Widgets`, so a new page needs no registration. There are three dashboards: `Dashboard.php` (the welcome page), `ShopDashboard.php` at `routePath` `shop` with a `filtersForm` of `startDate`, `endDate`, `orderStatuses` and `productCategory` and eight widgets, and `HrDashboard.php` at `hr` with five. Fourteen widgets live in `app/Filament/Widgets`, and each has a test under `tests/Filament/Widgets`.

The patterns are concrete. `ShopKpisStats` extends `StatsOverviewWidget`, uses `InteractsWithPageFilters` to read the page's dates, and returns `Stat::make()` entries with a description, a sparkline from `->chart()` and a colour; `CustomerGrowthChart` extends `ChartWidget`, returns `line` from `getType()` and builds month labels from the filter range in `getData()`; `FlaggedOrders` extends `TableWidget` with a full column span and a query, columns and a default sort. The blog has what a dashboard needs: `App\Models\Blog\Post` with a `published_at` date cast, `author()`, `postCategory()` and a `comments()` morph, and `App\Models\Comment` with an `is_visible` boolean. `PostFactory` gives `published_at` a range from six months back to a month ahead, so scheduled posts exist, and `CommentFactory` flips `is_visible` at random.

The agent adds `app/Filament/Pages/BlogDashboard.php` at `routePath` `blog` with the next `navigationSort` and a `filtersForm` of `startDate`, `endDate` and a `postCategory` select from `PostCategory::pluck('name', 'id')`, and four widgets in `app/Filament/Widgets`: `BlogKpisStats` with published posts, scheduled posts (a `published_at` in the future), comments, and hidden comments awaiting review, each with a monthly sparkline; `PostsPerMonthChart`, a bar chart over the filter range; `PostsByCategoryChart`, a doughnut; and `CommentsAwaitingReview`, a table widget of comments where `is_visible` is false, sorted oldest first, with a link to the commented post. Every widget reads the page filters the way `ShopKpisStats` does, and the navigation icon resolves through `DemoIconAlias` with a Heroicon fallback like the other two dashboards.

Tests follow the existing files one for one: a `tests/Filament/Widgets/<Widget>Test.php` per widget that creates posts and comments with the factories and asserts `Livewire::test()` renders, and `tests/Filament/Pages/BlogDashboardTest.php` that requests `BlogDashboard::getUrl()` and asserts 200, as `ShopDashboardTest` does. `tests/Pest.php` already wraps everything under `tests/Filament` in `RefreshDatabase` and signs in a user. The agent runs `composer test`, which is Pest in parallel plus PHPStan at level 8, and `vendor/bin/pint --test`, and pushes only when all three are clean.

## Start it with one API call

`POST https://api.phoenix.so/o/{org}/sessions`

```json
{
  "agent": "claude",
  "input": "A Linear issue labelled agent asks for a Blog dashboard in the admin panel: a page at /admin/blog with date and category filters, KPI stats for published posts, scheduled posts, comments and comments awaiting review, a posts-per-month chart, a posts-by-category chart, and a table of comments awaiting review. Read composer.json, app/Providers/Filament/AdminPanelProvider.php, app/Filament/Pages/ShopDashboard.php, app/Filament/Pages/HrDashboard.php, app/Filament/Widgets/ShopKpisStats.php, app/Filament/Widgets/CustomerGrowthChart.php, app/Filament/Widgets/FlaggedOrders.php, app/Models/Blog/Post.php, app/Models/Comment.php, database/factories/Blog/PostFactory.php, database/factories/CommentFactory.php, tests/Pest.php, tests/Filament/Pages/ShopDashboardTest.php and one widget test first. Add app/Filament/Pages/BlogDashboard.php with a filtersForm and four widgets under app/Filament/Widgets that read the page filters the way ShopKpisStats does, with a test per widget and a page test in the same style as the existing ones. Change no existing page or widget. Run composer test and vendor/bin/pint --test until both pass, and open a pull request that links the issue and lists the widgets.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    }
  ]
}
```

1. **Get an API key.** In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
2. **Send the request.** POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
3. **Read what came back.** Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

## What comes back

What comes back is a pull request on its own branch. It adds `app/Filament/Pages/BlogDashboard.php`, four files under `app/Filament/Widgets`, four tests under `tests/Filament/Widgets` and `tests/Filament/Pages/BlogDashboardTest.php`, and changes nothing that exists; the Shop and HR dashboards and their widgets are untouched. The description quotes the issue, lists each widget with the query behind it, and names the route.

The checks are the proof. The repository's `tests` workflow runs on the pull request with PHP 8.4 and SQLite, builds the assets and runs `composer test:pest`; the `phpstan` workflow runs `composer test:phpstan` at level 8. The trajectory at `GET /o/{org}/sessions/{id}/messages` keeps the local Pest, PHPStan and Pint output beside the commands, so a reviewer sees the suite ran on the new widgets rather than reading that it did.

Before merging, a reviewer opens the page in a local checkout seeded with `composer setup` to see the charts with data, checks the definition of a scheduled post against how their editors use `published_at`, and decides whether comments awaiting review belong on this dashboard or on the comment resource. The `format` workflow that auto-commits Pint fixes runs only on the default branch, so the pull request has to be clean on its own, which is why the agent runs Pint before pushing.

## Run it on every Linear issue labelled agent

Connect Linear once from Settings → Connections, then add an automation to the Project that holds the panel with this prompt and a `linear` trigger on `linear.issue.labeled`, naming the label in `config.labels`. The trigger appends the labelled issue after the prompt and fills in no placeholder, so the agent reads the widgets and the route from the issue text. Each labelled issue starts its own run in its own sandbox and ends in its own pull request, up to the automation's `max_runs_per_hour`.

A handler on your own server can do the same: when Linear's webhook reports the label, it sends `POST /o/{org}/sessions` with the repository and `https://linear.app/<workspace>/issue/<ID>` in `resources`, which puts the issue in the prompt through your Linear connection, with a `request_id` that is a UUID v5 of the issue id so a redelivered webhook returns the run it already started.

## Why run it on Rush?

A Filament dashboard is judged by whether it renders with real data, and that means a seeded database, a built asset bundle and the full Pest and PHPStan run for every change to a query. On a laptop that loop takes a running database, the right PHP and a Node build, and a level 8 PHPStan pass that is easy to skip when it is slow. In a Rush sandbox the agent sets that up once, runs `composer test` after each widget, reads the failure and fixes the query, and pushes only when the suite and the type analysis are clean.

The pull request carries its proof: the repository's own `tests` and `phpstan` workflows run on it, and the transcript keeps the local output beside the commands. A second issue, for an authors dashboard or a tag cloud widget, is a second sandbox and a second pull request at the same time.

## Frequently asked questions

### Does it register the page or the widgets anywhere?

No. `AdminPanelProvider` discovers pages under `app/Filament/Pages` and widgets under `app/Filament/Widgets` by namespace, so new classes in those directories appear on their own; the page lists its widgets in `getWidgets()` the way `ShopDashboard` does. The agent changes no provider and no existing page.

### What counts as a scheduled post?

A post whose `published_at` is after now, which is the only state the model records: `Post` casts `published_at` as a date and has no status column. `PostFactory` sets `published_at` anywhere from six months back to a month ahead, so the tests have both kinds. If your editors use a separate status, the prompt can name it and the stat changes accordingly.

### Will the filters work like the Shop dashboard's?

Yes. `BlogDashboard` uses the same `HasFiltersForm` trait with `startDate`, `endDate` and a `postCategory` select, and each widget reads them through `InteractsWithPageFilters` as `ShopKpisStats` and `CustomerGrowthChart` do, falling back to the last twelve months when the dates are empty. The category filter applies to posts and to the comments table through the commented post.

### Why does PHPStan matter for a dashboard?

Because `composer test` runs it at level 8 over `app/` and the `phpstan` workflow runs it on every pull request, so a widget with an untyped closure or a wrong return type fails the check even when it renders. The agent runs it locally before pushing and fixes the types rather than lowering the level.

### Can it change the existing dashboards too?

Not in this run. The prompt says to change no existing page or widget, so the Shop and HR dashboards keep their widgets and sort order. A follow-up issue can move a widget onto the welcome `Dashboard` page or rename the navigation group once the team has seen the new page.

## More Filament jobs

- [Add a Bulk Export Action to a Filament Table from a Linear Issue](https://getrush.ai/run/add-bulk-export/filament/)
- [Add Test Coverage to CI for a Filament App](https://getrush.ai/run/add-coverage-to-ci/filament/)
- [Add a CSV Import to a Filament Resource](https://getrush.ai/run/add-csv-import/filament/)

## More jobs like this: Turn a Linear label into a PR

- [Add Dev and Production Build Flavors to a Flutter App](https://getrush.ai/run/add-build-flavors/flutter/)
- [Add Bulk Inserts to a sqlc and pgx Project](https://getrush.ai/run/add-bulk-inserts/sqlc/)
- [Add a Bundle Size Check to a TypeScript Library from a Linear Issue](https://getrush.ai/run/add-bundle-size-check/typescript-library/)

## Keep reading

- [How a Rush run works on your repository, from request to pull request](https://getrush.ai/cloud/)
- [Compare cloud agents, agent sandboxes and AI code review](https://getrush.ai/compare/)
- [Rush pricing: Free, Pro and Max](https://getrush.ai/pricing/)
