feat: meal post ingredients
This commit is contained in:
@@ -8,6 +8,7 @@ use Illuminate\Database\Eloquent\Concerns\HasUlids;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class MealPosts extends Model
|
||||
@@ -37,12 +38,17 @@ class MealPosts extends Model
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
public function ingredients(): HasMany
|
||||
{
|
||||
return $this->hasMany(MealPostIngredients::class)->orderBy('position');
|
||||
}
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'eaten_at' => 'datetime',
|
||||
'visibility' => MealPostVisibility::class,
|
||||
'type' => MealPostType::class
|
||||
'type' => MealPostType::class,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user