ticket type rework
This commit is contained in:
@@ -3,40 +3,31 @@
|
||||
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'],
|
||||
$project->ticketTypes()->create(
|
||||
[
|
||||
'is_builtin' => true,
|
||||
'name' => 'Task',
|
||||
'position' => 1,
|
||||
],
|
||||
);
|
||||
|
||||
$project->ticketTypes()->firstOrCreate(
|
||||
['system_key' => 'parent'],
|
||||
$project->ticketTypes()->create(
|
||||
[
|
||||
'is_builtin' => true,
|
||||
'name' => 'Parent',
|
||||
'name' => 'Release',
|
||||
'is_parent' => true,
|
||||
'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();
|
||||
});
|
||||
$project->ticketPriorities()->create(
|
||||
[
|
||||
'name' => 'Medium',
|
||||
'position' => 1,
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user