Files
eatvio-infra/app/Models/Meal.php
2022-06-02 12:02:58 +00:00

36 lines
670 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use App\Models\UserAttachment;
class Meal extends Model
{
use HasFactory;
protected $fillable = ['*'];
public function user()
{
return $this->belongsTo(User::class)->withDefault([
'name' => 'Guest Author',
]);
}
public function diary()
{
return $this->belongsTo(Diary::class);
}
public function portions()
{
return $this->hasMany(Portion::class);
}
public function photos()
{
return $this->belongsToMany(UserAttachment::class);
}
}