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>
This commit is contained in:
Doar Mihai
2026-06-28 16:35:42 +03:00
co-authored by Claude Sonnet 4.6
parent 310dfd4129
commit 8dbcdfd70c
2 changed files with 118 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
<?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);
}
}