Files
dailydish/app/Models/RecipeNutrition.php
T

43 lines
924 B
PHP
Raw Normal View History

2026-08-09 20:15:40 +03:00
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class RecipeNutrition extends Model
{
protected $table = 'recipe_nutrition';
protected $fillable = [
'recipe_id',
'calories',
'protein',
'carbohydrates',
'fat',
'saturated_fat',
'fiber',
'sugar',
'sodium',
'cholesterol',
];
protected $casts = [
'recipe_id' => 'integer',
'calories' => 'integer',
'protein' => 'decimal:2',
'carbohydrates' => 'decimal:2',
'fat' => 'decimal:2',
'saturated_fat' => 'decimal:2',
'fiber' => 'decimal:2',
'sugar' => 'decimal:2',
'sodium' => 'decimal:2',
'cholesterol' => 'decimal:2',
];
public function recipe(): BelongsTo
{
return $this->belongsTo(Recipe::class);
}
}