actions
Move to top
Move a card to the first slot in its column. Requires card reordering.
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:
- The board has an order field configured with
orderField(). - The card is not already first in its column.
See card reordering for the migration and setup.
Example
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
- Overview — registering record actions
- Card reordering — order field setup and position logic