Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
andreiio committed Nov 20, 2024
1 parent fbe7e22 commit de168cd
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions database/factories/ElectionFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,19 @@ class ElectionFactory extends Factory
public function definition(): array
{
$title = fake()->words(3, true);
$year = fake()->numberBetween(1991, date('Y'));
$date = fake()->dateTimeBetween(
'1990-01-01',
'now'
);

return [
'type' => fake()->randomElement(ElectionType::values()),
'title' => $title,
'slug' => Str::slug("$title-$year"),
'slug' => Str::slug("{$title}-{$date->format('Y')}"),
'subtitle' => Lottery::odds(1, 5)
->winner(fn () => fake()->word())
->loser(fn () => null),
'year' => $year,
'date' => $date,
'is_live' => false,
'properties' => [],
];
Expand Down Expand Up @@ -92,7 +95,7 @@ public function live(): static
{
return $this->state(fn (array $attributes) => [
'is_live' => true,
'year' => now()->year,
'date' => today(),
]);
}

Expand Down

0 comments on commit de168cd

Please sign in to comment.