Implement ticket types priorities and custom fields

This commit is contained in:
2026-03-25 01:28:25 +01:00
parent 3f9b83ec16
commit 35aacff318
32 changed files with 1832 additions and 1 deletions
@@ -0,0 +1,42 @@
<?php
namespace App\Actions\ProjectTicketMetadata;
use App\Models\Project;
use App\Models\TicketType;
class InitializeProjectTicketMetadata
{
public function handle(Project $project): void
{
$project->ticketTypes()->firstOrCreate(
['system_key' => 'task'],
[
'is_builtin' => true,
'name' => 'Task',
'position' => 1,
],
);
$project->ticketTypes()->firstOrCreate(
['system_key' => 'parent'],
[
'is_builtin' => true,
'name' => 'Parent',
'position' => 2,
],
);
$project->ticketTypes()
->whereIn('system_key', TicketType::BUILTIN_KEYS)
->orderBy('position')
->get()
->values()
->each(function (TicketType $ticketType, int $index): void {
$ticketType->forceFill([
'is_builtin' => true,
'position' => $index + 1,
])->saveQuietly();
});
}
}