30 lines
548 B
PHP
30 lines
548 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Enums\IngredientUnit;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class MealPostIngredients extends Model
|
|
{
|
|
protected $fillable = [
|
|
'meal_posts_id',
|
|
'position',
|
|
'ingredient',
|
|
'unit',
|
|
];
|
|
|
|
public function mealPosts(): BelongsTo
|
|
{
|
|
return $this->belongsTo(MealPosts::class);
|
|
}
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'unit' => IngredientUnit::class,
|
|
];
|
|
}
|
|
}
|