ilbronza / tasks
Laravel task management with conversations, attachments and client participation
Requires
- php: ^8.2
- ilbronza/accountmanager: ^2.5
- ilbronza/buttons: *
- ilbronza/crud: ^2.5
- ilbronza/datatables: *
- ilbronza/form: *
- ilbronza/formfield: *
- ilbronza/menu: *
- ilbronza/notes: ^3.0
- ilbronza/uikittemplate: *
- ilbronza/ukn: *
- laravel/framework: >=10.48
- ramsey/uuid: ^4.0
- spatie/laravel-activitylog: >=4.0
- spatie/laravel-medialibrary: >=10.13
- spatie/laravel-permission: >=5.11
Requires (Dev)
- fakerphp/faker: ^1.23
- mockery/mockery: ^1.6
- orchestra/testbench: ^9.0
- phpunit/phpunit: ^11.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Laravel task management for the IlBronza packages: workflow states, assignees, deadlines, conversations, private attachments and client participation.
Installation
composer require ilbronza/tasks:^1.0 php artisan migrate
The package uses Laravel auto-discovery and depends on ilbronza/notes:^3.0.
It is designed for an existing IlBronza Laravel application (CRUD, AccountManager,
Menu and UikitTemplate), including the application's base controller and User model.
Enable the menu with tasks.models.task.enabled = true (or the existing
notes.models.task.enabled setting). The workspace remains at /tasks-management.
Staff land on the CRUD DataTable for both open and completed tasks. Click a title
to open its conversation and attachments, or choose Bacheca in the toolbar
for the board. Existing links with ?view=table, ?view=board or ?view=list
still work. Applications can override the table columns via
tasks.models.task.fieldsGroupsFiles.index.
Staff can manage tasks and invite existing user accounts as participants. Clients see only invited tasks and shared messages. Internal messages and their files remain private. Removing a participant revokes conversation and attachment access.
Upgrading from Notes
See UPGRADING.md before updating Notes 2.x. Applications using tasks must install both Notes 3 and Tasks 1 in the same deployment. Existing application classes, configuration, URLs and data continue to work after that dependency change.
Configuration
Publishing configuration is optional:
php artisan vendor:publish --tag=tasks.config
tasks.models.task.class: application-specific Task subclass.tasks.models.task.enabled: show task menu entries (defaults to false, as in Notes).tasks.models.task.table: defaults to the existingnotes__taskstable.tasks.routePrefix: defaults tonotesmanagertasks.; URL paths remain unchanged.tasks.defaultRoles/tasks.routeRoles: staff route access.tasks.conversation.staffRoles: optional staff-role override.tasks.conversation.disk: private attachment disk; defaults tolocal.tasks.conversation.participantsTable: defaults tonotes__task_participants.
Unspecified settings fall back to the old Notes settings, then package defaults. Explicit Tasks settings take precedence. Role lists are replaced, not combined. Keep client roles out of the staff-role lists.
Use IlBronza\Tasks\Models\Task for new code. Existing subclasses of
IlBronza\Notes\Models\Task remain valid. userCanSee, userCanUpdate,
userCanDelete and userCanComment retain their existing extension points.
Add tasks to menu.serviceProviders for task-only menu integration. Existing
notes registration still includes tasks; registering both does not duplicate them.
Projects
Run php artisan migrate when installing or upgrading. The package creates a
default project named after config('app.name') (Laravel's APP_NAME). Set
tasks.defaultProjectName before migration to choose a different initial name.
Existing tasks, including completed and soft-deleted ones, join this project.
New tasks use it whenever their creator leaves the project unspecified. Renaming
the default project keeps these associations and the default for future tasks.
Staff can open Progetti from the board or the task management menu to create or rename projects. Select Progetto when creating or editing a task. The board and list start on Tutti i progetti. Choosing a project filters the tasks and counters, including completed tasks. Nuova attività on a filtered board preselects that project. Participants can filter their invited tasks and only see project names associated with visible tasks.
Staff can set optional default additional assignees on each project. New tasks start with those people selected, and the creator can add, replace or clear them. Changing the project defaults affects future tasks only. For synchronized tasks, the hub applies the defaults of the corresponding hub project.
Client projects, orders and planning
In client mode, users enabled to create tasks can create projects from Progetti in the task workspace. They can manage their own projects before adding tasks. Client administrators can manage all local projects. The existing default project and other legacy projects remain selectable. Project creation and renaming go through the client outbox, including empty projects. The hub uses the installation and local project UUID to identify each project.
Open Commesse in the project table to link one or more local orders. Each order
belongs to at most one Tasks project. Remove it from its current project before
reassigning it. The selector uses the model configured in
products.models.order.class or the explicit tasks.orderModel override.
It respects the order model's userCanSee and its Laravel view policy when
registered. Hosts with additional tenant restrictions can override
Project::canLinkOrder(). The association lives in the local Tasks pivot.
Products keeps its quotation-project relationship and order IDs stay on the
installation that owns them.
Open Gantt from the workspace, the staff table or a project. The view filters by project and task status. Pianifica opens the dates for an individual task, including tasks listed under Da pianificare. Set both dates with the finish after the start, or clear both. The existing start and due date keep their historical values. Staff can also set the plan in the normal task form. Clients can plan visible tasks they created or whose project they manage. Client administrators can plan all visible local tasks when enabled to create tasks. The synchronizer exchanges planned dates and safely retries plan changes.
For an upgrade, install the release and run php artisan migrate on the hub
first, then on participating clients. The Gantt uses the standard JavaScript
and CSS bundles configured in timeline.assets. Hosts adding Timeline for the
first time must include its frontend entries and compile them as described in
the Timeline installation guide.
Automatic tasks for HTTP 500
Run php artisan migrate and set TASKS_REPORT_HTTP_500=true on each
application that should report its HTTP 500 responses. The setting defaults to
off. Refresh the configuration cache on hosts that use it. For client mode,
update and migrate the portal before enabling the feature on its clients.
Laravel sends its usual response and reports exceptions through the host's existing handler. During request termination, Tasks opens an activity in the default project. Repeats for the same method, route and exception source update the count, latest timestamp and log reference in one internal conversation note. After a task is closed or deleted, the next occurrence opens a new one. On clients, closure takes effect once the regular sync has pulled the portal update.
The task description records the application and route definition. The UUID in the internal note also identifies the occurrence in the application log. Staff with access to the task can open Dettagli attività → Diagnostica errore 500 and move between individual occurrences. In client mode this page is available to staff on the portal after synchronization. Each new occurrence has an encrypted report, separate from the task conversation. Earlier occurrences retain the information collected at the time.
Reports include the exception messages and cause chain, stack frames with file
and line, PHP and Laravel versions, route, authenticated user ID and available
route, query and input variables. They also collect application exception
context, visible Laravel log context and view data when available. When PHP
retains trace arguments, reports include named application arguments and the
types of third-party arguments. The collector respects the host's
zend.exception_ignore_args setting. An explicit 500 response without an
attached exception still records its request context.
To capture local variables, add this in the scope where the values exist:
use IlBronza\Tasks\Support\HttpErrorDiagnostics; try { $shipment->reserve($quantity); } catch (\Throwable $error) { throw HttpErrorDiagnostics::withVariables($error, get_defined_vars()); }
PHP cannot recover local variables after their frames have unwound. Each
snapshot identifies the file and line where it was taken. Credential fields
are masked. Configure additional field names in tasks.http_errors.redact_keys.
Objects are represented by type, Eloquent models by type and primary key.
Cookies, raw headers, session contents, file contents and SQL binding values
are excluded. Each report has a 256 KiB limit, with omission markers for
truncated data. If collection fails, the log identifies the affected occurrence
by UUID. Errors outside the Laravel HTTP lifecycle require server-level logs.
Ask the user what happened
Set TASKS_HTTP_500_FEEDBACK=true alongside TASKS_REPORT_HTTP_500=true after
migrating. Tasks adds an optional form to HTML error pages and opens a dialog
for same-origin fetch and XMLHttpRequest errors on pages with the Tasks header.
Custom layouts can include tasks::http-errors.dialog when
IlBronza\Tasks\Support\HttpErrorFeedback::enabled() returns true.
Each form accepts one message for 30 minutes. The message and the occurrence's log reference go into an internal conversation note on the original task, even if it was closed in the meantime. In client mode the note syncs to the portal. When the user was signed in at the time of the error, submitting the form also adds the task to that user's workspace on the application where it occurred. The Laravel scheduler removes expired form references hourly when enabled.
Client installations and central portal
TASKS_SYNC_MODE defaults to standalone. Install the same package version
and run php artisan migrate on the portal and on each participating client.
Refresh Laravel's configuration cache after changing environment settings on
installations that cache their configuration.
Enable the task menu with tasks.models.task.enabled on the applications that
should show it. If the host also uses AccountManager's route authorization,
grant reporters the existing task creation, workspace and conversation routes.
Portal
Set TASKS_SYNC_MODE=hub. Register one installation per customer using a
recognizable name. For example, from the portal run
php artisan tasks:register-client Idealpack
The command prints an installation UUID and a secret token. Give this pair to
that installation. The portal stores the token hash. To replace a credential,
run php artisan tasks:register-client Idealpack --rotate and update the client
token. The installation keeps its projects, tasks and sync revisions.
Client
Configure the customer application with the HTTPS base URL of the portal and the values printed during registration.
TASKS_SYNC_MODE=client TASKS_SYNC_HUB_URL=https://portal.example.com TASKS_SYNC_INSTALLATION=<installation UUID> TASKS_SYNC_TOKEN=<installation token>
Grant reporting users the taskReporter role on the web guard. You can create
it with php artisan permission:create-role taskReporter web and assign it
through AccountManager. The allowed roles are configurable in
tasks.sync.reporter_roles and include notes, administrator and
superadmin by default. Reporters can create a task, read their own or
invited tasks and add shared messages. The administrator role also sees all
active and completed tasks on the client installation, including their shared
messages. Administrators can reply to tasks they opened or were invited to.
On the client, administrators and superadmins can change the workflow status of tasks
they can already see, by dragging a card between board columns or selecting its status
in the detail panel. Configure tasks.sync.status_roles to change these roles (or
set it to an empty list to disable client changes). This grants no other edit access.
Status changes to historical, local-only tasks stay local; for synchronized tasks they
are queued with the local save and delivered by the next successful sync. Older feed
entries and duplicate deliveries do not revert a pending change. Upgrade and migrate
the hub first, then the client, before enabling this workflow.
The portal manages due date and synchronized assignees. The client displays the
assignee's name independently of its local user accounts.
The package schedules php artisan tasks:sync every minute in client mode.
Enable the usual Laravel scheduler on the client host. You can also run the
command directly to send pending reports, pull updates and check the counts.
Only the client needs outgoing HTTPS access. The sync command itself processes
the database outbox.
Data exchanged
- New client tasks are queued in the same transaction as the task. The opening includes the title, description, optional page link, requester name, creation time and local project. The project is identified by installation UUID and local project UUID, including the app-named default project.
- The screenshot attached when creating a task is sent after the opening and appears in an internal note on the portal.
- Automatic HTTP 500 tasks send the latest summary and a separate diagnostic report per occurrence. A retry preserves the first report for its UUID.
- Shared messages carry their author label and timestamp. Each can include one JPEG, PNG or WebP image up to 2 MiB and 6000 pixels per side in either direction. Images are stored with the private conversation in the database. The authenticated sync fetches the image separately from the change feed. Upgrade both ends before use. An older client pauses at a feed page containing an image and can resume after upgrading. Staff can attach files to internal portal notes.
- Portal CRUD saves publish the current title, workflow status, due date, primary and additional assignee display names and deletion/restoration state. Staff notes, assignment history, tracked time, commits and participant lists stay on their installation.
- Synchronization begins with tasks created in client mode. Enabling the mode leaves historical tasks and conversations in their original database.
The stateless API lives at /api/tasks-sync/v1 on the hub. All operations
require an Authorization: Bearer token and an X-Tasks-Installation UUID.
| Method | Path | Operation |
|---|---|---|
| PUT | tasks/{localTaskUuid} |
Accept an opening once for the authenticated installation. |
| PUT | tasks/{localTaskUuid}/status/{eventUuid} |
Apply a newer client status revision for that installation's task. |
| POST | tasks/{localTaskUuid}/screenshot |
Attach one screenshot to the opening, with safe retries. |
| PUT | tasks/{localTaskUuid}/http-error |
Update the internal summary with a newer occurrence count. |
| PUT | tasks/{localTaskUuid}/http-error-diagnostics/{reference} |
Store the private diagnostic report for one occurrence. |
| PUT | tasks/{localTaskUuid}/http-error-feedback/{reference} |
Append one internal note for the occurrence. |
| PUT | tasks/{localTaskUuid}/messages/{localNoteUuid} |
Append one shared text message, with safe retries. |
| PUT / GET | tasks/{localTaskUuid}/messages/{noteUuid}/image |
Send an illustrated reply or fetch the image for a shared portal reply. |
| GET | changes?after={revision} |
Read up to 100 consecutive changes belonging to that installation. |
The client acknowledges an outbound item after a successful hub response. It saves downloaded changes and their revision together. An interrupted command can resume on the next scheduler tick. Keep the sync tables with the task database in backups. Use normal Eloquent/CRUD saves for portal changes so the task and its outgoing revision share a transaction.
Task link
The create/edit form includes an optional link field next to the description.
It accepts HTTP/HTTPS URLs up to 2048 characters and can be changed or cleared
later. Staff see a clickable link in the task's details, opening in a new tab.
Like the internal description, the link is not shared with client participants.
Run php artisan migrate to add the column; existing tasks start with no link.
Create a task from the current page
The Tasks menu includes Crea attività da questa pagina for users allowed to create tasks. It opens the usual create form in an iframe. The current page URL, including query parameters and fragment, is copied into the editable Link field. The creator is always the authenticated user. Saving creates the task and closes the popup; opening or cancelling the form does not create a record.
In supported browsers, clicking the menu entry prompts you to share the current tab before the form opens. Cancelling the browser prompt opens the form without an image. After a capture, Ritaglia selects the area to keep. Apply the crop and choose Usa screenshot e continua, or choose Scarta e continua to open the form without an image. Saving adds the accepted image to the task conversation as a private attachment.
To add the same action to an application menu, use the helper via the facade in
App\Providers\Helpers\MenuItems::loadProjectMenuItems():
use IlBronza\Tasks\Facades\Tasks; Tasks::addCreateMenuButton(); // Or place a separately named action under an existing parent button: Tasks::addCreateMenuButton($parentButton, [ 'name' => 'project.createTask', 'text' => 'tasks::tasks.createFromPage', 'icon' => 'plus', ]);
By default the menu action shows the Trello icon with a translated tooltip and
a screen-reader label. Pass text or translatedText to show a visible label.
The helper returns the registered Button, or null when creation is not
permitted, and reuses existing menu entries by name. It supports the traditional
and progressive/AJAX menu, including the mobile sidebar. The URL is read by the
iframe when opened, so cached menu items never retain another page's link.
No additional JavaScript build or parent-page include is required. Validation
errors preserve the submitted link; application-provided defaults are also kept.
Assignments and history
Each task can have a primary assignee in assignee_user_id and multiple additional assignees. The create and edit forms and the workspace assignment dialog accept additional assignees from the same eligible user list. Promoting one to primary removes their additional assignment. Both kinds of assignment appear in the internal history. The assignee filter and Assigned to me include both roles. Staff who can update
the task can change or clear that assignee in the workspace's details panel,
with an optional comment. The usual create/edit form also accepts
assignment_comment. Eligible recipients come from getPossibleAssignees()
(the existing taskAssignee role by default).
Every actual change appends one row to tasks__assignments, containing the task,
authenticated author, previous assignee, recipient, comment and timestamp.
The task itself retains its ID. Names are also captured at the time of the change,
so later account renames or deletions do not rewrite history. Changes and comments
appear together in the internal conversation; clients cannot see them.
Run php artisan migrate when upgrading. Existing assignments are preserved;
history starts with subsequent changes, without inventing past authors or dates.
The history table name can be overridden with tasks.assignments.table.
Normal Eloquent saves (including the existing CRUD forms) save the assignment and
history in one transaction. Application code can set assignment_comment before
calling save(). Without an authenticated user, the author is recorded as Sistema.
Bulk query-builder updates and direct SQL bypass model tracking and must not be
used for assignment changes. Re-saving the same assignee creates no history;
a comment without a change is rejected so it cannot be silently discarded.
Subtasks
Open Subtasks from the staff table or the task detail panel. Create subtask opens the usual task form and preselects the parent's project when available. Each subtask has its own assignees, dates, status and conversation. The counter shows completed direct children out of the children visible to the current user. Closing a task affects that task alone. Soft-deleting a parent leaves its children accessible independently, and restoring it restores navigation.
Staff can use Change parent task to move an existing task with its children
or clear the parent to make it a top-level task. A branch supports five levels
of subtasks below the root. Access to each task follows its own permissions.
Applications that manage route grants can grant parent.edit and parent.update
under their configured Tasks route prefix.
Upgrade and migrate the portal before enabling subtasks on sync clients. Client reporters can create subtasks on synchronized tasks they can plan. The portal maps parent IDs within the originating installation and sends subsequent parent changes back to that client. Children created directly on the portal are local tasks, including when their parent came from a client.
Daily workspace
Apply the package migrations on the portal and each client. Existing primary assignments are preserved. The new controls are available from the standard staff table toolbar and from the list and board.
- Needs review shows open, unreviewed tasks with no assignees, ordered by priority and then oldest opening date. Staff can mark a task reviewed or take ownership and start work. The detail panel shows the source, priority and HTTP error recurrence information. The last occurrence timestamp is recorded for reports received after upgrading.
- My updates brings together unread assignments and replies on visible tasks, including completed tasks. Reading the conversation acknowledges updates for that user. Internal messages stay within the staff workspace.
- Under My views, choose a preset or save the current project, search, assignee, queue and layout under a name. Named views are personal to the current account, browser and open/completed workspace.
- Under Task details, staff can change priority, specify who owes the next reply on a waiting task and manage a checklist. Cards and list rows show completed steps out of the total. These operations and checklist contents stay on the portal for synchronized work.
- Local assignees can access their assigned task and its shared conversation. Staff and custom model access rules govern internal notes and staff operations. The client displays synchronized assignees using installation-specific identifiers.
- Applications using AccountManager route grants can enable
review,checklist.update,checklist.destroyfor the relevant staff andconversation.readfor workspace users under their configured Tasks route prefix.
Testing
From the parent package workspace:
python3 .ibtest/bin/ibtest.py Tasks python3 .ibtest/bin/ibtest.py Notes
The suites cover workspace behavior, staff/client permissions, attachment access, legacy aliases, native and legacy configuration, model URLs, menu integration, existing databases and Notes without Tasks. The shared test environment is Laravel 11 / Testbench 9 / SQLite. It emits two upstream PDO deprecations on PHP 8.5.
License
MIT. Extracted from ilBronza/Notes, retaining its original copyright and license.