Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace Functional\Exercises\Database\Factories;
|
||||
|
||||
use Functional\Exercises\Models\Exercise;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<Exercise>
|
||||
*/
|
||||
class ExerciseFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
$name = fake()->unique()->words(3, true);
|
||||
$ext = fake()->unique()->numerify('####');
|
||||
|
||||
return [
|
||||
'external_id' => $ext,
|
||||
'name' => $name,
|
||||
'slug' => \Illuminate\Support\Str::slug($name . '-' . $ext),
|
||||
'category' => fake()->randomElement(['waist', 'chest', 'back', 'upper legs', 'shoulders']),
|
||||
'body_part' => fake()->randomElement(['waist', 'chest', 'back', 'upper legs', 'shoulders']),
|
||||
'equipment' => fake()->randomElement(['body weight', 'dumbbell', 'barbell', 'cable', 'kettlebell']),
|
||||
'target' => fake()->randomElement(['abs', 'pectorals', 'lats', 'quads', 'delts']),
|
||||
'muscle_group' => fake()->word(),
|
||||
'secondary_muscles' => fake()->randomElements(['hip flexors', 'lower back', 'triceps', 'glutes'], 2),
|
||||
'instructions' => ['en' => [fake()->sentence()], 'fr' => [fake()->sentence()]],
|
||||
'image_path' => 'exercises/' . $ext . '.jpg',
|
||||
'gif_path' => 'exercises/' . $ext . '.gif',
|
||||
'attribution' => '© Gym visual — https://gymvisual.com/',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('exercises', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('external_id')->unique(); // "0001" du dataset
|
||||
$table->string('name');
|
||||
$table->string('slug')->index();
|
||||
$table->string('category')->nullable()->index(); // waist, chest...
|
||||
$table->string('body_part')->nullable()->index(); // upper arms, back...
|
||||
$table->string('equipment')->nullable()->index(); // dumbbell, body weight...
|
||||
$table->string('target')->nullable()->index(); // muscle cible principal
|
||||
$table->string('muscle_group')->nullable(); // synergistes primaires
|
||||
$table->json('secondary_muscles')->nullable(); // ["deltoid", ...]
|
||||
$table->json('instructions')->nullable(); // { en:[...], fr:[...] }
|
||||
$table->string('image_path')->nullable(); // clé S3 / chemin média
|
||||
$table->string('gif_path')->nullable();
|
||||
$table->string('attribution')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('exercises');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace Functional\Exercises\Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class ExercisesSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user