first commit
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user