April 2026 waren Wirtschaft Feedback
This commit is contained in:
parent
02f2a4c23e
commit
9ce711d6b2
167 changed files with 25278 additions and 8518 deletions
|
|
@ -9,6 +9,7 @@ namespace App\Models;
|
|||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/**
|
||||
* Class Ingredient
|
||||
|
|
@ -25,10 +26,10 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @property Carbon $created_at
|
||||
* @property Carbon $updated_at
|
||||
* @property Collection|Product[] $products
|
||||
* @package App\Models
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\ProductIngredient[] $product_ingredients
|
||||
* @property-read Collection|ProductIngredient[] $product_ingredients
|
||||
* @property-read int|null $product_ingredients_count
|
||||
* @property-read int|null $products_count
|
||||
*
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Ingredient newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Ingredient newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Ingredient query()
|
||||
|
|
@ -43,38 +44,52 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Ingredient whereTransInci($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Ingredient whereTransName($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Ingredient whereUpdatedAt($value)
|
||||
*
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class Ingredient extends Model
|
||||
{
|
||||
protected $table = 'ingredients';
|
||||
protected $table = 'ingredients';
|
||||
|
||||
protected $casts = [
|
||||
'active' => 'bool',
|
||||
'pos' => 'int'
|
||||
];
|
||||
protected $casts = [
|
||||
'active' => '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'
|
||||
];
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'trans_name',
|
||||
'inci',
|
||||
'trans_inci',
|
||||
'effect',
|
||||
'trans_effect',
|
||||
'active',
|
||||
'pos',
|
||||
'default_factor',
|
||||
'min_stock_alert',
|
||||
'material_quality_id',
|
||||
];
|
||||
|
||||
public function products()
|
||||
{
|
||||
return $this->belongsToMany(Product::class, 'product_ingredients')
|
||||
->withPivot('id')
|
||||
->withTimestamps();
|
||||
}
|
||||
/**
|
||||
* @return BelongsTo<MaterialQuality, $this>
|
||||
*/
|
||||
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, 'product_ingredients', 'id');
|
||||
|
||||
return $this->hasMany(ProductIngredient::class, 'ingredient_id');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue