19 lines
423 B
PHP
19 lines
423 B
PHP
<?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();
|
|
}
|
|
}
|