10.April 2026
This commit is contained in:
parent
a00c42e770
commit
f58c709945
208 changed files with 19280 additions and 2914 deletions
44
database/factories/IncentiveFactory.php
Normal file
44
database/factories/IncentiveFactory.php
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Incentive;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class IncentiveFactory extends Factory
|
||||
{
|
||||
protected $model = Incentive::class;
|
||||
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'name' => 'Incentive '.$this->faker->city().' '.$this->faker->year(),
|
||||
'description' => $this->faker->sentence(),
|
||||
'terms' => $this->faker->paragraph(),
|
||||
'qualification_start' => '2026-04-01',
|
||||
'qualification_end' => '2026-07-31',
|
||||
'calculation_end' => '2026-08-31',
|
||||
'points_partner_onetime' => 600,
|
||||
'points_abo_onetime' => 400,
|
||||
'min_direct_partners' => 4,
|
||||
'min_customer_abos' => 6,
|
||||
'max_winners' => 30,
|
||||
'status' => 1, // active
|
||||
];
|
||||
}
|
||||
|
||||
public function draft(): static
|
||||
{
|
||||
return $this->state(['status' => 0]);
|
||||
}
|
||||
|
||||
public function active(): static
|
||||
{
|
||||
return $this->state(['status' => 1]);
|
||||
}
|
||||
|
||||
public function closed(): static
|
||||
{
|
||||
return $this->state(['status' => 2]);
|
||||
}
|
||||
}
|
||||
21
database/factories/IncentiveNewAboFactory.php
Normal file
21
database/factories/IncentiveNewAboFactory.php
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\IncentiveNewAbo;
|
||||
use App\Models\IncentiveParticipant;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class IncentiveNewAboFactory extends Factory
|
||||
{
|
||||
protected $model = IncentiveNewAbo::class;
|
||||
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'participant_id' => IncentiveParticipant::factory(),
|
||||
'user_abo_id' => $this->faker->randomNumber(3),
|
||||
'activated_at' => now(),
|
||||
];
|
||||
}
|
||||
}
|
||||
22
database/factories/IncentiveNewPartnerFactory.php
Normal file
22
database/factories/IncentiveNewPartnerFactory.php
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\IncentiveNewPartner;
|
||||
use App\Models\IncentiveParticipant;
|
||||
use App\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class IncentiveNewPartnerFactory extends Factory
|
||||
{
|
||||
protected $model = IncentiveNewPartner::class;
|
||||
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'participant_id' => IncentiveParticipant::factory(),
|
||||
'user_id' => fn () => User::inRandomOrder()->first()?->id ?? 1,
|
||||
'registered_at' => now(),
|
||||
];
|
||||
}
|
||||
}
|
||||
46
database/factories/IncentiveParticipantFactory.php
Normal file
46
database/factories/IncentiveParticipantFactory.php
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
<?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,
|
||||
]);
|
||||
}
|
||||
}
|
||||
51
database/factories/IncentivePointsLogFactory.php
Normal file
51
database/factories/IncentivePointsLogFactory.php
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\IncentiveParticipant;
|
||||
use App\Models\IncentivePointsLog;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class IncentivePointsLogFactory extends Factory
|
||||
{
|
||||
protected $model = IncentivePointsLog::class;
|
||||
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'participant_id' => IncentiveParticipant::factory(),
|
||||
'type' => 'partner',
|
||||
'source_type' => 'App\\User',
|
||||
'source_id' => 1,
|
||||
'source_label' => $this->faker->name(),
|
||||
'month' => 4,
|
||||
'year' => 2026,
|
||||
'points_onetime' => 600,
|
||||
'points_accumulated' => 0,
|
||||
'is_storno' => false,
|
||||
];
|
||||
}
|
||||
|
||||
public function partner(): static
|
||||
{
|
||||
return $this->state([
|
||||
'type' => 'partner',
|
||||
'points_onetime' => 600,
|
||||
]);
|
||||
}
|
||||
|
||||
public function abo(): static
|
||||
{
|
||||
return $this->state([
|
||||
'type' => 'abo',
|
||||
'points_onetime' => 400,
|
||||
]);
|
||||
}
|
||||
|
||||
public function storno(): static
|
||||
{
|
||||
return $this->state([
|
||||
'is_storno' => true,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue