Add multi-week workout programs

A Workout was a single flat session with no way to schedule several
across weeks/days as a structured plan (e.g. Push/Pull/Legs over 4
weeks) - every user started from a blank builder each time, and there
was no template concept at all.

Adds a Program (title, description, week count) that Workouts can
optionally belong to via nullable program_id/week_number/day_number
columns, reusing all existing workout and session-tracking
infrastructure rather than building a parallel system. The program show
page lays out the schedule week by week and derives progress (completed
vs total) from the user's existing WorkoutSession completions - no new
enrollment/progress-tracking concept needed. Deleting a program
unschedules its workouts (nullOnDelete) rather than destroying them.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-10 12:21:47 +03:00
co-authored by Claude Sonnet 5
parent fa8bf46f8a
commit ebd0578dc9
15 changed files with 564 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
<?php
namespace Database\Factories;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Program>
*/
class ProgramFactory extends Factory
{
public function definition(): array
{
return [
'user_id' => User::factory(),
'title' => ucfirst(fake()->words(3, true)) . ' Program',
'description' => fake()->sentence(),
'weeks' => fake()->numberBetween(3, 8),
];
}
}