39 lines
976 B
PHP
39 lines
976 B
PHP
<?php
|
|
|
|
namespace App\Actions\ProjectTicketMetadata;
|
|
|
|
use App\Models\Project;
|
|
|
|
class InitializeProjectTicketMetadata
|
|
{
|
|
public function handle(Project $project): void
|
|
{
|
|
if (! $project->ticketTypes()->exists()) {
|
|
$project->ticketTypes()->create([
|
|
'name' => 'Task',
|
|
'position' => 1,
|
|
]);
|
|
|
|
$project->ticketTypes()->create([
|
|
'name' => 'Release',
|
|
'is_parent' => true,
|
|
'position' => 2,
|
|
]);
|
|
}
|
|
|
|
if (! $project->ticketPriorities()->exists()) {
|
|
$project->ticketPriorities()->create([
|
|
'name' => 'Medium',
|
|
'position' => 1,
|
|
]);
|
|
}
|
|
|
|
if (! $project->ticketStatuses()->whereNull('board_column_id')->exists()) {
|
|
$project->ticketStatuses()->create([
|
|
'name' => 'Backlog',
|
|
'position' => 1,
|
|
]);
|
|
}
|
|
}
|
|
}
|