- 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>
70 lines
2 KiB
PHP
70 lines
2 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Created by Reliese Model.
|
|
*/
|
|
|
|
namespace App\Models;
|
|
|
|
use Carbon\Carbon;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
/**
|
|
* Class ProductIngredient
|
|
*
|
|
* @property int $id
|
|
* @property int $product_id
|
|
* @property int $ingredient_id
|
|
* @property Carbon $created_at
|
|
* @property Carbon $updated_at
|
|
* @property Ingredient $ingredient
|
|
* @property Product $product
|
|
*
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductIngredient newModelQuery()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductIngredient newQuery()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductIngredient query()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductIngredient whereCreatedAt($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductIngredient whereId($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductIngredient whereIngredientId($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductIngredient whereProductId($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ProductIngredient whereUpdatedAt($value)
|
|
*
|
|
* @mixin \Eloquent
|
|
*/
|
|
class ProductIngredient extends Model
|
|
{
|
|
protected $table = 'product_ingredients';
|
|
|
|
protected $casts = [
|
|
'product_id' => 'int',
|
|
'ingredient_id' => 'int',
|
|
'pos' => 'int',
|
|
'gram' => 'decimal:6',
|
|
'factor' => 'decimal:2',
|
|
];
|
|
|
|
protected $fillable = [
|
|
'product_id',
|
|
'ingredient_id',
|
|
'pos',
|
|
'gram',
|
|
'factor',
|
|
'recipe_type',
|
|
'recipe_phase_id',
|
|
];
|
|
|
|
public function ingredient()
|
|
{
|
|
return $this->belongsTo(Ingredient::class, 'ingredient_id');
|
|
}
|
|
|
|
public function product()
|
|
{
|
|
return $this->belongsTo(Product::class, 'product_id');
|
|
}
|
|
|
|
public function phase()
|
|
{
|
|
return $this->belongsTo(RecipePhase::class, 'recipe_phase_id');
|
|
}
|
|
}
|