Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
<?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),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user