30 lines
679 B
PHP
30 lines
679 B
PHP
<?php
|
|
|
|
namespace App\Actions\Tickets;
|
|
|
|
use App\Enums\TicketWorklogEntryType;
|
|
use App\Models\Ticket;
|
|
use App\Models\TicketWorklogEntry;
|
|
use App\Models\User;
|
|
|
|
class CreateTicketWorklogEntry
|
|
{
|
|
/**
|
|
* @param array<string, mixed>|null $changes
|
|
*/
|
|
public function handle(
|
|
Ticket $ticket,
|
|
?User $actor,
|
|
TicketWorklogEntryType $entryType,
|
|
string $summary,
|
|
?array $changes = null,
|
|
): TicketWorklogEntry {
|
|
return $ticket->worklogEntries()->create([
|
|
'actor_id' => $actor?->id,
|
|
'changes' => $changes,
|
|
'entry_type' => $entryType,
|
|
'summary' => $summary,
|
|
]);
|
|
}
|
|
}
|