Warp

Type a whole stock count into Filament, one column at a time

5 min read

It is the last day of the month. Someone walks the warehouse with a clipboard and counts every shelf. Back at the desk, the counts have to go into your Filament panel: open a product, click Edit, change the stock, Save, go back to the list, find the next product. For 300 products, that is an afternoon, and one wrong click can save the wrong number on the wrong product.

This article shows the same job with Warp Sheet: the products are listed like a spreadsheet, the counts are typed down one column with the keyboard, and one Save writes them all. Every picture is from the live demo, so you can try it yourself.

The scene: a list of products and one column to fill in

This is the stock count page. SKU, name and category are read-only. Only the "Counted" column can be changed. The demo has 85,045 active products in one sheet, with no pagination.

A spreadsheet-like list of products with the columns SKU, Name, Category and Counted, and a sum of the Counted column at the bottom
The stock count sheet. 85,045 rows, and the total of the column at the bottom.

Step 1: a sheet page for the products

The page is a resource page that extends SheetPage. The sheet gets a query and its columns, and Counted gets the rules it must follow.

use Qalainau\FilamentWarpSheet\Columns;
use Qalainau\FilamentWarpSheet\Pages\SheetPage;
use Qalainau\FilamentWarpSheet\Sheet;

class StockCountSheet extends SheetPage
{
    protected static string $resource = StockCountResource::class;

    public function sheet(Sheet $sheet): Sheet
    {
        return $sheet
            ->query(Product::query()->where('is_active', true))
            ->columns([
                Columns\Text::make('sku')->readOnly()->frozen(),
                Columns\Text::make('name')->readOnly(),
                Columns\Text::make('category.name'),
                Columns\Number::make('stock')
                    ->label('Counted')
                    ->rules(['required', 'integer', 'min:0', 'max:100000'])
                    ->color(fn (?int $value): ?string => match (true) {
                        $value === 0 => 'danger',
                        $value < 10 => 'warning',
                        default => null,
                    })
                    ->summarize(['sum', 'count']),
            ])
            ->searchable(['sku', 'name', 'category.name']);
    }
}

In the resource, getPages() returns 'index' => StockCountSheet::route('/'), as for any Filament page. A related column like category.name is shown but never edited.

Step 2: type the counts down the column

Click the first "Counted" cell and type the number. Typing replaces the value, as in a spreadsheet, and Enter moves to the cell below. There is no need to touch the mouse again until the end of the shelf.

Seven counts with the keyboard only, then one Save.

While you type, the sheet shows what changed. Changed cells turn orange and get a bar at the left of the row, and the button now reads "Save 7 changes". The colors from color() follow the new values before anything is saved: 3 turns amber (fewer than 10), 0 turns red.

Seven Counted cells changed and shown in orange, a value of 3 in amber, a value of 0 in red, and a green button reading Save 7 changes
Seven counts typed and not saved yet.

The min:0 and integer rules are checked in the browser the moment a cell changes. A typo like -5 or 12a is marked straight away, with Laravel's message, before anyone presses Save.

Step 3: review, then save everything at once

Before saving, "Review" opens a list of every change, record by record, with the old value crossed out and the new one next to it. A wrong line can be reverted from here.

A Review panel on the right listing the changes: row 1 Counted 400 to 398, row 2 453 to 450, row 3 0 to 3, with a Revert link on each
Every change with its old value. Useful when the count looks too far from what the system had.

"Save 7 changes" writes them in one transaction. The save is all or nothing: every record is checked against your policy and the column rules first, and if one fails, its cell is marked and nothing is written.

The sheet after saving: no orange cells, the Save button disabled and the sum at the bottom changed
Saved. The total of the column is worked out again over all 85,045 products.

Keep a record of each count

The demo writes one line per counted product into a stock_counts table, in the same transaction as the save, with afterSave():

->afterSave(function (array $updated): void {
    // $updated holds the primary keys that were saved
    $countedBy = auth()->user()->name;

    foreach (array_chunk($updated, 500) as $keys) {
        DB::table('stock_counts')->insert(
            Product::query()->whereKey($keys)->pluck('stock', 'id')
                ->map(fn (int $stock, int $id): array => [
                    'product_id' => $id,
                    'counted' => $stock,
                    'counted_by' => $countedBy,
                    'created_at' => now(),
                    'updated_at' => now(),
                ])->values()->all()
        );
    }
})
A modal titled Recent counts listing the seven saved products with the counted quantity, who counted and when
"Recent counts" in the demo reads that table.

If the stock must not change while someone is counting, beforeSave() can stop the save by throwing SaveAborted with a message for the user.

Show the difference instead of overwriting

In the demo, "Counted" is the product's stock itself, so the count replaces the system quantity. If your count lives in its own column, a computed column shows the difference while people type:

Columns\Number::make('counted_quantity'),
Columns\Computed::make('difference')
    ->formula('counted_quantity - expected_quantity')
    ->color(fn (?int $value): ?string => match (true) {
        $value > 0 => 'success',
        $value < 0 => 'danger',
        default => null,
    }),

The browser recalculates the formula as soon as a count is typed, before saving.

Other keys that help on count day

  • Ctrl/Cmd+D fills the selected range down with the first value (a whole shelf of 0).
  • Ctrl/Cmd+V pastes a column copied from a spreadsheet, if the counts were done on a tablet.
  • Ctrl/Cmd+Z and Ctrl/Cmd+Y undo and redo, F2 edits a cell without replacing it, Escape cancels.
  • The search box and the filters narrow the sheet to one aisle or one category, and the totals follow the filter.

Other scenes for the same sheet

  • Goods receipt: type the received quantities next to the ordered ones.
  • Price update: search a supplier's products and change one price column.
  • Budget: a row per account, a column per month.
  • Cleanup: fix categories or names on hundreds of records in one sitting.

Limits worth knowing

  • A sheet is a page for a whole resource. For lines inside a form (an order's items), use a repeater.
  • There are no formulas typed by users, no multiple sheets and no Excel formatting. Pasting brings values only.
  • One save can touch up to 100,000 records by default (maxChangesPerSave()).
  • Conflicts use updated_at. If someone changed the same column after the sheet was loaded, the save stops for that record. A change to another column is merged.

Try it

Open the stock count demo. Click the first "Counted" cell, type a few numbers with Enter after each, press "Review", then save. "Recent counts" shows what you saved. No sign-up, and the data is reset every hour.

More from the blog

See who is free next week and book them, in Filament

An agency manager needs 40 hours for a project that starts Monday. The planner shows only the people who have the time, the booking is a drag, and the overbooked project manager gets a fix in two clicks.

Laravel Rust vs Laravel Go vs Laravel PHP: The Complete Real-World Benchmark Guide

We benchmarked Laravel Rust, Laravel Go v0.1.0, and Laravel PHP (FPM, FrankenPHP, Swoole, Workerman) across 8 real workloads on the exact same machine — from 1,000-user spikes and heavy ORM to 100k-row deep pagination. Continuously updated as new tests land.

Work through support tickets without leaving the list, in Filament

A support agent opens a ticket, assigns it, sets it to pending and moves on to the next one with the arrow key. The list stays on the left; the View and Edit pages you already have open on the right.

Filament + AI coding tips, by email

How to fit Warp plugins into your own app and pair them with Claude Code or Cursor: prompts that work, mistakes AI makes, real examples. Once or twice a month. Unsubscribe anytime.

Ask us anything about Warp

No email address or sign-up needed.

We read every question and answer here on the site, usually within a day. Others see your question after we have checked it.

What's stopping you from using Warp's plugins?

One question. We read every answer, and it decides what we build next. It is not shown on the site.

What's stopping you from using Warp's plugins?