'bool', 'pos' => 'int', 'default_factor' => 'decimal:2', 'min_stock_alert' => 'decimal:2', ]; protected $fillable = [ 'name', 'trans_name', 'inci', 'trans_inci', 'effect', 'trans_effect', 'active', 'pos', 'default_factor', 'min_stock_alert', 'material_quality_id', ]; /** * @return BelongsTo */ public function materialQuality(): BelongsTo { return $this->belongsTo(MaterialQuality::class); } public function products() { return $this->belongsToMany(Product::class, 'product_ingredients') ->withPivot('id', 'pos', 'gram', 'factor') ->withTimestamps() ->orderByPivot('pos'); } public function product_ingredients() { return $this->hasMany(ProductIngredient::class, 'ingredient_id'); } }