Remove recipe name field; use product title internally
Deploy / deploy (push) Successful in 15s

The recipe name input is dropped from the product form — the version
number alone identifies a recipe. The product title is stored as the
internal name to satisfy the NOT NULL constraint. The history table
no longer shows the name column.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Malek TellissiandClaude Sonnet 4.6 committed 2026-09-12 06:00:18 +02:00
1 parent a7e7375edd
commit 269570c7d6
4 files changed
+6 -19

No files matched your search

@@ -27,12 +27,11 @@ class CreateProduct extends CreateRecord
]);
}
$recipeName = $data['recipe_name'] ?? null;
$spices = $data['recipe_spices'] ?? [];
$spices = $data['recipe_spices'] ?? [];
if ($recipeName) {
if (! empty($spices)) {
$recipe = Recipe::create([
'name' => $recipeName,
'name' => $data['title'],
'product_id' => $record->id,
'version' => 1,
]);
@@ -52,10 +52,9 @@ class EditProduct extends EditRecord
protected function syncRecipe(): void
{
$product = $this->record;
$name = $this->data['recipe_name'] ?? null;
$spices = $this->data['recipe_spices'] ?? [];
if (! $name) {
if (empty($spices)) {
return;
}
@@ -72,10 +71,7 @@ class EditProduct extends EditRecord
$s->id => (float) $s->pivot->amount_in_percent,
])->toArray();
$nameChanged = $current->name !== $name;
$spicesChanged = $existingPivot != $newPivot;
if (! $nameChanged && ! $spicesChanged) {
if ($existingPivot == $newPivot) {
return;
}
}
@@ -83,7 +79,7 @@ class EditProduct extends EditRecord
$nextVersion = Recipe::where('product_id', $product->id)->max('version') + 1;
$recipe = Recipe::create([
'name' => $name,
'name' => $product->title,
'product_id' => $product->id,
'version' => $nextVersion,
]);
@@ -60,8 +60,6 @@ class RecipeHistory extends Page implements HasTable
->formatStateUsing(fn ($state) => 'v' . $state)
->badge()
->color(fn (Recipe $recipe) => $recipe->id === $currentRecipeId ? 'success' : 'gray'),
TextColumn::make('name')
->label('Name'),
TextColumn::make('spices_summary')
->label('Zutaten')
->state(fn (Recipe $recipe) =>