Build & Deploy / build (push) Successful in 18s
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
40 lines
1.0 KiB
PHP
40 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace Functional\Streaks\Database\Factories;
|
|
|
|
use Functional\Streaks\Enums\GoalPeriod;
|
|
use Functional\Streaks\Enums\GoalType;
|
|
use Functional\Streaks\Models\Goal;
|
|
use Functional\Users\Models\User;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/**
|
|
* @extends Factory<Goal>
|
|
*/
|
|
class GoalFactory extends Factory
|
|
{
|
|
protected $model = Goal::class;
|
|
|
|
/**
|
|
* Define the model's default state.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function definition(): array
|
|
{
|
|
$type = fake()->randomElement(GoalType::cases());
|
|
|
|
return [
|
|
'user_id' => User::factory(),
|
|
'type' => $type,
|
|
'target' => match ($type) {
|
|
GoalType::WeeklySessions => fake()->numberBetween(2, 6),
|
|
GoalType::WeeklyMinutes => fake()->numberBetween(60, 300),
|
|
GoalType::WeeklyVolume => fake()->numberBetween(1000, 10000),
|
|
},
|
|
'period' => GoalPeriod::Week,
|
|
'is_active' => fake()->boolean(85),
|
|
];
|
|
}
|
|
}
|