Files
Doar MihaiandClaude Sonnet 4.6 8dbcdfd70c feat: add GymSession model and TrainingService
Implements gym training logic with daily session tracking:
- GymSession model manages training sessions per stat per day
- TrainingService handles training validation, energy consumption, and stat gains
- Lazy daily reset: session count resets when reset_date is before today
- Validates: sufficient energy, daily cap (5 sessions per stat), valid stats

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-28 16:35:42 +03:00

33 lines
626 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* @property int $id
* @property int $character_id
* @property string $stat
* @property int $sessions_today
* @property \Illuminate\Support\Carbon $reset_date
*/
class GymSession extends Model
{
protected $fillable = [
'character_id',
'stat',
'sessions_today',
'reset_date',
];
protected $casts = [
'reset_date' => 'date',
];
public function character(): BelongsTo
{
return $this->belongsTo(Character::class);
}
}