feat: sincronizar client_number con RFC al actualizar cliente

This commit is contained in:
Juan Felipe Zapata Moreno 2026-03-06 10:54:48 -06:00
parent 232d9ccaa6
commit 2db5cafb21

View File

@ -116,7 +116,7 @@ public function update(Request $request, Client $client)
try{ try{
$client->update($request->only([ $data = $request->only([
'name', 'name',
'email', 'email',
'phone', 'phone',
@ -126,7 +126,14 @@ public function update(Request $request, Client $client)
'regimen_fiscal', 'regimen_fiscal',
'cp_fiscal', 'cp_fiscal',
'uso_cfdi', 'uso_cfdi',
])); ]);
// Mantener client_number sincronizado con RFC cuando se actualiza
if ($request->filled('rfc')) {
$data['client_number'] = $data['rfc'];
}
$client->update($data);
return ApiResponse::OK->response([ return ApiResponse::OK->response([
'client' => $client, 'client' => $client,