All pages

actions

Move to top

Move a card to the first slot in its column. Requires card reordering.

php
use Asmit\AdvancedKanban\RecordAction\MoveToTopAction;

MoveToTopAction::make('moveToTop')

Moves the card to the top of its column in one click — the same result as dragging it above every other card in that column.

Requirements

Move to top only appears when all of the following are true:

  1. The board has an order field configured with orderField().
  2. The card is not already first in its column.

See card reordering for the migration and setup.

Example

php
use Asmit\AdvancedKanban\Kanban;
use Asmit\AdvancedKanban\RecordAction\EditAction;
use Asmit\AdvancedKanban\RecordAction\MoveToTopAction;

public function kanban(Kanban $kanban): Kanban
{
    return $kanban
        ->model(Task::class)
        ->statusField('status')
        ->orderField('position')
        ->recordActions([
            EditAction::make('edit')->schema([/* ... */]),
            MoveToTopAction::make('moveToTop'),
        ])
        ->columns([/* ... */]);
}

How it works

The action finds the first card in the column and calls moveRecord() with that card as the neighbour below, placing the current card above it. If the card is already first, the action hides itself.

See also