ingredient_id.'|'.($this->recipe_phase_id !== null ? (int) $this->recipe_phase_id : ''); } /** * F-03: Chargen-Schlüssel für das Formular — im Entwurf der roh gespeicherte * batch_key, sonst aus dem aufgelösten Wareneingang abgeleitet. */ public function formBatchKey(): string { if (! empty($this->batch_key)) { return (string) $this->batch_key; } return $this->stockEntry?->batchGroupKey() ?? 'e:'.$this->stock_entry_id; } /** * @return array */ protected function casts(): array { return [ 'quantity_used' => 'decimal:2', ]; } /** * @return BelongsTo */ public function production(): BelongsTo { return $this->belongsTo(Production::class); } /** * @return BelongsTo */ public function ingredient(): BelongsTo { return $this->belongsTo(Ingredient::class); } /** * @return BelongsTo */ public function stockEntry(): BelongsTo { return $this->belongsTo(StockEntry::class); } }