-
Notifications
You must be signed in to change notification settings - Fork 2
Description
Introduction
I noticed there was no straightforward way to add a Kanban view to your data, so I developed a new Kanban feature that allows you to easily update the status of a task, among other things.
How it works
-
Functionality:
- Adds a Kanban view to your CRUD panel
- Allows dragging and dropping items between columns
- Supports customizable columns and fields
- Provides routes for fetching and updating Kanban items
- Search on title inside the Kanban
-
Implementation:
To implement the Kanban operation in your CRUD controller, you need to use theKanbanOperationtrait and configure it. Here's how you can do it:
use App\Http\Controllers\Admin\Operations\KanbanOperation;
class TaskCrudController extends CrudController
{
use KanbanOperation;
protected function setupKanbanOperation()
{
CRUD::set('kanban.columns', [
'pending' => 'in afwachting',
'approved' => 'actief',
'completed' => 'voltooid',
]);
}
protected function getKanbanFieldsMap(): array
{
return [
'id' => 'id',
'title' => 'name',
];
}
}In this implementation:
-
We use the
KanbanOperationtrait in the controller. -
We override the
setupKanbanOperation()method to customize the Kanban columns. In this case, we're setting three columns: 'pending', 'approved', and 'completed', with their respective Dutch translations. -
We override the
getKanbanFieldsMap()method to define which fields from your model should be used for the Kanban items. Here, we're mapping the 'id' and 'name' fields from your model to the expected Kanban item fields.
By default, the addon uses the 'status' field to determine which column an item belongs to. If your model uses a different field name for this purpose, you can set it like this:
protected function getKanbanFieldsMap(): array
{
CRUD::set('kanban.column_field', 'your_status_field_name');
}After implementing this, you should see a new Kanban view option in your CRUD panel, allowing you to manage your entries in a Kanban board format.

