openfoodfacts-api/app/Models/Product.php

33 lines
711 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Product extends Model
{
use HasFactory;
protected $guarded = ['id'];
protected $casts = [
'no_nutriments' => 'boolean',
'additives_n' => 'integer',
'ingredients_from_palm_oil_n' => 'integer',
'ingredients_that_may_be_from_palm_oil_n' => 'integer',
'nutriscore_score' => 'integer',
'nova_group' => 'integer',
];
public function ingredients()
{
return $this->hasMany(Ingredient::class);
}
public function nutritionFacts()
{
return $this->hasMany(NutritionFact::class);
}
}