mandant-crm/backend/app/Modules/Client/Actions/UpdateClientAction.php

20 lines
423 B
PHP
Raw Normal View History

<?php
namespace App\Modules\Client\Actions;
use App\Modules\Client\DTOs\ClientData;
use App\Modules\Client\Models\Client;
final class UpdateClientAction
{
public function handle(Client $client, ClientData $data): Client
{
$client->update(array_filter([
'name' => $data->name,
'notes' => $data->notes,
], fn ($v) => $v !== null));
return $client->fresh();
}
}