36 lines
1003 B
PHP
36 lines
1003 B
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Enums\WorkoutSource;
|
|
use App\Models\User;
|
|
use App\Models\WorkoutSessions;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
use Illuminate\Support\Carbon;
|
|
|
|
/**
|
|
* @extends Factory<WorkoutSessions>
|
|
*/
|
|
class WorkoutSessionsFactory extends Factory
|
|
{
|
|
protected $model = WorkoutSessions::class;
|
|
|
|
/**
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'user_id' => User::factory(),
|
|
'external_id' => null,
|
|
'source' => WorkoutSource::MANUAL,
|
|
'type' => $this->faker->randomElement(['running', 'cycling', 'strength']),
|
|
'title' => $this->faker->words(3, true),
|
|
'duration_seconds' => $this->faker->numberBetween(600, 7200),
|
|
'calories_burned' => $this->faker->numberBetween(50, 1200),
|
|
'distance_meters' => $this->faker->numberBetween(0, 50000),
|
|
'started_at' => Carbon::now(),
|
|
];
|
|
}
|
|
}
|