feat: add theme update

This commit is contained in:
2026-06-24 17:24:31 +03:30
parent a6f41ed6f8
commit b24af706a0
2 changed files with 24 additions and 0 deletions
+22
View File
@@ -23,4 +23,26 @@ public function show($id)
{
return response()->json(Theme::findOrFail($id));
}
// Edit an existing theme — typically its color map. The `key` is the stable
// identifier the app maps against, so it is intentionally not editable here.
public function update(Request $request, $id)
{
$theme = Theme::findOrFail($id);
$data = $request->validate([
'name' => 'sometimes|string|max:255',
'colors' => 'sometimes|array',
'colors.*' => 'nullable|string|max:32',
'order' => 'sometimes|integer',
'is_active' => 'sometimes|boolean',
]);
$theme->update($data);
return response()->json([
'message' => 'Theme updated successfully',
'data' => $theme,
]);
}
}