46 lines
1.1 KiB
PHP
46 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\Incentive;
|
|
use App\Models\IncentiveParticipant;
|
|
use App\User;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
class IncentiveParticipantFactory extends Factory
|
|
{
|
|
protected $model = IncentiveParticipant::class;
|
|
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'incentive_id' => Incentive::factory(),
|
|
'user_id' => fn () => User::inRandomOrder()->first()?->id ?? 1,
|
|
'accepted_terms_at' => now(),
|
|
'total_points' => 0,
|
|
'qualified_partners' => 0,
|
|
'qualified_abos' => 0,
|
|
'is_qualified' => false,
|
|
'rank' => null,
|
|
];
|
|
}
|
|
|
|
public function qualified(): static
|
|
{
|
|
return $this->state([
|
|
'is_qualified' => true,
|
|
'qualified_partners' => 4,
|
|
'qualified_abos' => 6,
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* Automatisch angelegt, Teilnahmebedingungen noch nicht akzeptiert (anonym in der Rangliste).
|
|
*/
|
|
public function unconfirmed(): static
|
|
{
|
|
return $this->state([
|
|
'accepted_terms_at' => null,
|
|
]);
|
|
}
|
|
}
|