mandant-crm/backend/app/Modules/History/Actions/CreateHistoryEntryAction.php

23 lines
626 B
PHP
Raw Permalink Normal View History

<?php
namespace App\Modules\History\Actions;
use App\Models\User;
use App\Modules\Client\Models\Client;
use App\Modules\History\DTOs\HistoryEntryData;
use App\Modules\History\Models\HistoryEntry;
final class CreateHistoryEntryAction
{
public function handle(Client $client, HistoryEntryData $data, User $author): HistoryEntry
{
return HistoryEntry::create([
'client_id' => $client->id,
'history_entry_type_id' => $data->historyEntryTypeId,
'occurred_at' => $data->occurredAt,
'body' => $data->body,
'author_id' => $author->id,
]);
}
}