π§ KanbanColumn Configuration Options β
1. KanbanColumn Methods Overview β
This section provides a complete reference of all available methods in the KanbanColumn class with their descriptions and parameters.
Method | Description | Parameters |
---|---|---|
make() | Create a new KanbanColumn instance | string $status |
label() | Set the display label for the column | string|Closure $label |
description() | Set the column description | string $description |
icon() | Set the column icon | string|Closure|ScalableIcon $icon |
iconColor() | Set the icon color | string|Closure $color |
hidden() | Hide or show the column | bool|Closure $hidden = true |
allowedTransitions() | Set allowed status transitions | array|Closure $transitions |
lockCardUsing() | Set card locking condition | string|Closure $icon |
lockedIcon() | Set locked icon | bool|Closure|ScalableIcon $icon = true |
lockedLabel() | Set locked label | string|Closure $label = true |
modifyRecordQueryUsing() | Modify query for column records | Closure $callback |
2. Column Creation Methods β
2.1 make(string $status)
β
Creates a new KanbanColumn instance with the specified status.
KanbanColumn::make('todo')
KanbanColumn::make('in-progress')
KanbanColumn::make('done')
3. Display Configuration Methods β
3.1 label(string|Closure $label)
β
Sets the display label for the column. This is what users will see as the column header.
->label('To Do')
->label('In Progress')
->label('Under Review')
->label(fn() => 'Custom ' . ucfirst($this->status))
3.2 description(string $description)
β
Sets a description for the column that can be displayed as a tooltip or subtitle.
->description('Tasks that need to be started')
->description('Tasks currently being worked on')
->description('Completed tasks ready for review')
3.3 color(string|Closure $color)
β
Sets the color theme for the column. Can be a string or closure for dynamic colors.
->color('gray')
->color('blue')
->color('green')
->color('red')
->color(fn() => $this->status === 'urgent' ? 'red' : 'gray')
3.4 iconColor(string|Closure $color)
β
Sets the color for the column icon.
->iconColor('gray')
->iconColor('blue')
->iconColor(Heroicon::OutlinedRectangleStack)
->iconColor('red')
->iconColor(fn() => $this->status === 'urgent' ? 'red' : 'gray')
4. Visibility Configuration Methods β
4.1 hidden(bool|Closure $hidden = true)
β
Hides or shows the column. Useful for conditional column display.
->hidden(true) // Hide the column
->hidden(false) // Show the column
->hidden(fn() => auth()->user()->cannot('view-archived'))
->hidden(fn() => $this->status === 'archived' && !$showArchived)
5. Workflow Configuration Methods β
5.1 allowedTransitions(array|Closure $transitions)
β
Sets which statuses records can transition to from this column. Controls drag-and-drop behavior.
// Simple array format
->allowedTransitions(['in-progress'])
// Multiple allowed transitions
->allowedTransitions(['in-progress', 'review'])
// No transitions allowed (final state)
->allowedTransitions([])
// Dynamic transitions based on conditions
->allowedTransitions(fn() => [
'in-progress',
auth()->user()->can('skip-review') ? 'done' : 'review'
])
// Complex workflow rules
->allowedTransitions(fn() => match($this->status) {
'todo' => ['in-progress'],
'in-progress' => ['review', 'todo'],
'review' => ['done', 'in-progress'],
'done' => ['review'],
default => []
})
6. Card Behavior Configuration Methods β
6.1 lockCardUsing(bool|Closure $condition = true)
β
Sets conditions for when cards in this column should be locked (prevented from moving).
// Lock all cards in this column
->lockCardUsing(true)
// Never lock cards in this column
->lockCardUsing(false)
// Lock cards based on record properties
->lockCardUsing(fn($record) => $record->priority === 'urgent')
6.2 lockedIcon(bool|Closure|ScalableIcon $icon = true)
β
Sets the icon for the locked state of the column.
->lockedIcon(Heroicon::OutlineLockClosed)
->lockedIcon(fn() => $this->status === 'urgent' ? Heroicon::OutlineLockClosed : Heroicon::OutlineLockOpen)
6.3 lockedLabel(bool|Closure|string $label = true)
β
Sets the label for the locked state of the column.
->lockedLabel('Locked')
->lockedLabel(fn() => $this->status === 'urgent' ? 'Urgently Locked' : 'Locked')
7. Query Modification Methods β
7.1 modifyRecordQueryUsing(Closure $callback)
β
Allows you to modify the query for records in this specific column. Provides access to the query and column object.
// Filter records based on column status
$kanban->modifyRecordQueryUsing(function ($query, $column) {
if ($column->getStatus() === 'urgent') {
return $query->where('priority', 'high');
}
return $query;
})
// Add custom ordering for specific columns
$kanban->modifyRecordQueryUsing(function ($query, $column) {
if ($column->getStatus() === 'done') {
return $query->orderBy('completed_at', 'desc');
}
return $query->orderBy('created_at', 'asc');
})
// Apply column-specific filters
$kanban->modifyRecordQueryUsing(function ($query, $column) {
if ($column->getStatus() === 'archived') {
return $query->where('is_archived', true);
}
return $query->where('is_archived', false);
})