advanced
Relational records
Put a board on a Manage Related Records page so it only shows a parent's records.
Use the MRR (Manage Related Records) setup to run a board over a relationship.
1. Create the page
php artisan make:filament-page ManageUserTasks --resource=UserResource --type=ManageRelatedRecords
2. Implement HasKanban
<?php
namespace App\Filament\Pages;
use App\Filament\Resources\UserResource;
use App\Models\Task;
use Asmit\AdvancedKanban\Columns\KanbanColumn;
use Asmit\AdvancedKanban\Concerns\HasKanbanRelatedRecords;
use Asmit\AdvancedKanban\Contracts\HasKanban;
use Asmit\AdvancedKanban\Kanban;
use Filament\Resources\Pages\ManageRelatedRecords;
class UserTasks extends ManageRelatedRecords implements HasKanban
{
use HasKanbanRelatedRecords; // ← Must use this trait
protected static string $resource = UserResource::class; // ← Set your resource
protected static string $relationship = 'tasks'; // ← Set your relationship
public function kanban(Kanban $kanban): Kanban
{
return $kanban
->model(Task::class) // ← Pass your model
->statusField('status') // ← Pass the status field
->titleField('title')
->descriptionField('description')
->columns([
KanbanColumn::make('To Do'), // ← Pass required column
KanbanColumn::make('In Progress'),
])
->searchableFields(['title', 'description'])
->recordsPerColumn(10);
}
}
3. That's it
The board shows only the records related to the parent you're viewing.
Checklist:
- Implement
HasKanban - Use
HasKanbanRelatedRecords - Set
$resourceto the parent resource - Set
$relationshipto the relationship name - Pass
->model(YourModel::class)and->statusField('your_status_field')
This works on MRR pages only. Regular relation managers are not supported.