Sub-lists and editing several
Tasks belong to a project: a sub-controller lists, adds and edits them inside the project, and changes several at once.
- "Edit several" applies only the fields you fill in.
Try it: log in with the demo account
Email demo@frontdesk-demo.test · Password Try-Frontdesk-2026
Everyone shares this account. You may change anything – all data is reset every night.
The code
app/src/Controllers/TaskSubController.php – The sub-controller
whole file
class TaskSubController extends FrontdeskSubController
{
private static string $managed_model = Task::class;
private static string $url_segment = 'tasks';
private static string $title = 'Tasks';
private static string $parent_field = 'ProjectID';
/**
* "Edit several": only filled fields are applied to the chosen tasks.
*/
private static array $bulk_edit_fields = ['Status', 'AssigneeID', 'DueDate'];
protected function getBaseQuery(): DataList
{
return Task::get()->filter('ProjectID', $this->getParentID());
}
protected function defineColumns(): ColumnCollection
{
return ColumnCollection::create()
->make('Title', 'Task')->sortable()->end()
->make('StatusLabel', 'Status')->type('badge')->sortable('Status')->end()
->make('DueDate', 'Due')
->format(fn ($value) => $value ? date('d M Y', (int) strtotime((string) $value)) : '')
->sortable()->end()
->make('Assignee.Name', 'Assignee')->sortable('Assignee.Surname')->end()
->make('Estimate', 'Estimate (h)')->sortable()->end();
}
// …
}
app/src/Controllers/ProjectController.php – Mounted in the project controller
whole file
private static array $sub_controllers = [
TaskSubController::class,
];
private static array $allowed_actions = [
'tasks',
];
public function tasks(HTTPRequest $request): TaskSubController
{
return TaskSubController::create()->setParentContext($this, (int) $request->param('ID'));
}