50 lines
989 B
PHP
50 lines
989 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class ProductionIngredient extends Model
|
|
{
|
|
protected $fillable = [
|
|
'production_id',
|
|
'ingredient_id',
|
|
'stock_entry_id',
|
|
'quantity_used',
|
|
];
|
|
|
|
/**
|
|
* @return array<string, string>
|
|
*/
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'quantity_used' => 'decimal:2',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @return BelongsTo<Production, $this>
|
|
*/
|
|
public function production(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Production::class);
|
|
}
|
|
|
|
/**
|
|
* @return BelongsTo<Ingredient, $this>
|
|
*/
|
|
public function ingredient(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Ingredient::class);
|
|
}
|
|
|
|
/**
|
|
* @return BelongsTo<StockEntry, $this>
|
|
*/
|
|
public function stockEntry(): BelongsTo
|
|
{
|
|
return $this->belongsTo(StockEntry::class);
|
|
}
|
|
}
|