gruene-seele/app/Models/RecipePhase.php
Kevin Adametz 97d420c98a Warenwirtschaft: AP-23 Rezeptur-Phasen (Hersteller-Rezeptur)
- Tabelle recipe_phases + product_ingredients.recipe_phase_id (nullable,
  rueckwaertskompatibel: Bestandsrezepturen bleiben phasenlos)
- Produktformular: Hersteller-Rezeptur in Phasen-Bloecke gegliedert
  (Name, Notiz, Rohstoffe je Phase, Drag&Drop auch zwischen Phasen,
  "+ Neue Phase", 100%-Summe global ueber alle Phasen)
- Repository: Phasen-Persistierung (Auto-Name Phase A/B..., einzelner
  unbenannter Block bleibt phasenlos), copy() uebernimmt Phasenstruktur
- Produktions-Sollmengen rechnen unveraendert ueber alle Zeilen
- Blade-Fix: inline @php() + @php-Block im selben Template paarten sich
  falsch (Raw-Block verschluckte halbes Formular) - auf Block-Form vereinheitlicht
- Hinweise-Doku fortgeschrieben

Tests: RecipePhaseTest (6 gruen), volle Suite 178 gruen, 649 Assertions

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-06 12:02:39 +00:00

47 lines
936 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
/**
* Rezeptur-Phase (Phase A/B …) der Hersteller-Rezeptur (AP-23).
*/
class RecipePhase extends Model
{
protected $fillable = [
'product_id',
'recipe_type',
'name',
'note',
'pos',
];
/**
* @return array<string, string>
*/
protected function casts(): array
{
return [
'pos' => 'integer',
];
}
/**
* @return BelongsTo<Product, $this>
*/
public function product(): BelongsTo
{
return $this->belongsTo(Product::class);
}
/**
* @return HasMany<ProductIngredient, $this>
*/
public function ingredientRows(): HasMany
{
return $this->hasMany(ProductIngredient::class)->orderBy('pos');
}
}