Refactor TenantController to use createWithProps and updateWithProps methods for improved property synchronization

This commit is contained in:
2026-06-24 10:40:30 -03:00
parent 8e5814e333
commit b2c8f13d2e

View File

@@ -23,8 +23,7 @@ class TenantController extends Controller
$props = $validated['props'] ?? [];
unset($validated['props']);
$tenant = Tenant::create($validated);
$tenant->syncPropValues($props);
$tenant = Tenant::createWithProps($validated, $props);
return TenantResource::make($tenant)->response()->setStatusCode(201);
}
@@ -40,8 +39,7 @@ class TenantController extends Controller
$props = $validated['props'] ?? [];
unset($validated['props']);
$tenant->update($validated);
$tenant->syncPropValues($props);
$tenant = $tenant->updateWithProps($validated, $props);
return TenantResource::make($tenant);
}