Init
This commit is contained in:
32
app/Models/Product.php
Normal file
32
app/Models/Product.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user