42 lines
903 B
PHP
42 lines
903 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class WineProduction extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $table = 'wine_productions';
|
|
|
|
protected $fillable = [
|
|
'wine_id',
|
|
'harvest_id',
|
|
'consumed_weight',
|
|
'blend_percentage',
|
|
];
|
|
|
|
protected $casts = [
|
|
'consumed_weight' => 'decimal:2',
|
|
'blend_percentage' => 'decimal:2',
|
|
];
|
|
|
|
/**
|
|
* Get the wine that this production record belongs to.
|
|
*/
|
|
public function wine(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Wine::class, 'wine_id');
|
|
}
|
|
|
|
/**
|
|
* Get the harvest used in this wine production.
|
|
*/
|
|
public function harvest(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Harvest::class, 'harvest_id');
|
|
}
|
|
}
|