42 lines
1.1 KiB
PHP
42 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\Contest;
|
|
use App\Models\EvaluationRuleSet;
|
|
use App\Models\Round;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/**
|
|
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Round>
|
|
*/
|
|
class RoundFactory extends Factory
|
|
{
|
|
protected $model = Round::class;
|
|
|
|
public function definition(): array
|
|
{
|
|
$title = $this->faker->words(3, true);
|
|
$start = now()->startOfDay()->addHours(14);
|
|
$end = (clone $start)->addHours(2);
|
|
$deadline = (clone $end)->addDays(2);
|
|
|
|
return [
|
|
'contest_id' => Contest::factory(),
|
|
'rule_set_id' => EvaluationRuleSet::factory(),
|
|
'name' => [
|
|
'cs' => $title,
|
|
'en' => $title,
|
|
],
|
|
'description' => [
|
|
'cs' => $this->faker->sentence(),
|
|
'en' => $this->faker->sentence(),
|
|
],
|
|
'start_time' => $start,
|
|
'end_time' => $end,
|
|
'logs_deadline' => $deadline,
|
|
'is_active' => true,
|
|
];
|
|
}
|
|
}
|