Files
eatvio-infra/app/Models/ChosenDiet.php
2023-05-22 09:52:08 +00:00

45 lines
742 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Iben\Statable\Statable;
class ChosenDiet extends Model
{
use HasFactory, Statable;
protected $fillable = [
'user_id',
'diet_id',
'last_state',
'start_date'
];
protected function getGraph()
{
return 'chosen_diet';
}
protected function saveBeforeTransition()
{
return true;
}
public function getActorId()
{
return $this->user_id;
}
public function user()
{
return $this->belongsTo(User::class);
}
public function diet()
{
return $this->belongsTo(Diet::class);
}
}