42 lines
834 B
PHP
42 lines
834 B
PHP
<?php
|
|||
|
|
|
||
|
|
namespace App\Models;
|
||
|
|
|
||
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||
|
|
use Illuminate\Database\Eloquent\Model;
|
||
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||
|
|
|
||
|
|
class WorkoutExercise extends Model
|
||
|
|
{
|
||
|
|
use HasFactory;
|
||
|
|
|
||
|
|
protected $fillable = [
|
||
|
|
'workout_id',
|
||
|
|
'exercise_id',
|
||
|
|
'position',
|
||
|
|
'sets',
|
||
|
|
'reps',
|
||
|
|
'weight',
|
||
|
|
'rest_seconds',
|
||
|
|
'notes',
|
||
|
|
];
|
||
|
|
|
||
|
|
protected $casts = [
|
||
|
|
'position' => 'integer',
|
||
|
|
'sets' => 'integer',
|
||
|
|
'reps' => 'integer',
|
||
|
|
'weight' => 'decimal:2',
|
||
|
|
'rest_seconds' => 'integer',
|
||
|
|
];
|
||
|
|
|
||
|
|
public function workout(): BelongsTo
|
||
|
|
{
|
||
|
|
return $this->belongsTo(Workout::class);
|
||
|
|
}
|
||
|
|
|
||
|
|
public function exercise(): BelongsTo
|
||
|
|
{
|
||
|
|
return $this->belongsTo(Exercise::class);
|
||
|
|
}
|
||
|
|
}
|