39 lines
820 B
PHP
39 lines
820 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
class GrapeVariety extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $table = 'grape_varieties';
|
|
|
|
protected $fillable = [
|
|
'variety_name',
|
|
'description',
|
|
'origin',
|
|
'wine_type',
|
|
'characteristics',
|
|
'image_url',
|
|
];
|
|
|
|
/**
|
|
* Get the variations for this grape variety.
|
|
*/
|
|
public function variations(): HasMany
|
|
{
|
|
return $this->hasMany(VarietyVariation::class, 'grape_variety_id');
|
|
}
|
|
|
|
/**
|
|
* Get the wines for this grape variety.
|
|
*/
|
|
public function wines(): HasMany
|
|
{
|
|
return $this->hasMany(Wine::class, 'grape_variety_id');
|
|
}
|
|
}
|