Files
mareike/app/Installer/ProductionDataSeeder.php
T

170 lines
7.2 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
namespace App\Installer;
use App\Enumerations\CostUnitType;
use App\Enumerations\CronTaskType;
use App\Enumerations\EatingHabit;
use App\Enumerations\EfzStatus;
use App\Enumerations\FirstAidPermission;
use App\Enumerations\InvoiceStatus;
use App\Enumerations\InvoiceType;
use App\Enumerations\ParticipationFeeType;
use App\Enumerations\ParticipationType;
use App\Enumerations\PaymentStatus;
use App\Enumerations\SwimmingPermission;
use App\Enumerations\UserRole;
use App\EventPaymentModules\EventPaymentModuleRegistry;
use App\Models\CronTask;
use App\Models\PaymentMethod;
use App\Models\Tenant;
class ProductionDataSeeder {
public function execute() {
$this->installCronTypes();
$this->installUserRoles();
$this->installCostUnitTypes();
$this->installSwimmingPermissions();
$this->installEatingHabits();
$this->installFirstAidPermissions();
$this->installInvoiceMetaData();
$this->installParticipationFeeTypes();
$this->installParticipationTypes();
$this->installEfzStatus();
$this->installPaymentMethods();
$this->installPaymentStatus();
}
private function installPaymentStatus() {
PaymentStatus::create(['slug' => PaymentStatus::PAYMENT_STATUS_PENDING]);
PaymentStatus::create(['slug' => PaymentStatus::PAYMENT_STATUS_SCHEDULED]);
PaymentStatus::create(['slug' => PaymentStatus::PAYMENT_STATUS_PAID]);
PaymentStatus::create(['slug' => PaymentStatus::PAYMENT_STATUS_FAILED]);
}
private function installPaymentMethods() {
foreach (EventPaymentModuleRegistry::slugs() as $slug) {
PaymentMethod::create(['slug' => $slug]);
}
}
private function installEfzStatus() {
EfzStatus::create(['slug' => EfzStatus::EFZ_STATUS_NOT_CHECKED, 'name' => 'Nicht geprüft']);
EfzStatus::create(['slug' => EfzStatus::EFZ_STATUS_NOT_REQUIRED, 'name' => 'Nicht erforderlich']);
EfzStatus::create(['slug' => EfzStatus::EFZ_STATUS_CHECKED_VALID, 'name' => 'Gültig']);
EfzStatus::create(['slug' => EfzStatus::EFZ_STATUS_CHECKED_INVALID, 'name' => 'Nicht eingereicht']);
}
private function installParticipationTypes() {
ParticipationType::create([
'slug' => ParticipationType::PARTICIPATION_TYPE_PARTICIPANT,
'name' => 'Teilnehmende'
]);
ParticipationType::create([
'slug' => ParticipationType::PARTICIPATION_TYPE_TEAM,
'name' => 'Kernteam'
]);
ParticipationType::create([
'slug' => ParticipationType::PARTICIPATION_TYPE_VOLUNTEER,
'name' => 'Unterstützende'
]);
ParticipationType::create([
'slug' => ParticipationType::PARTICIPATION_TYPE_OTHER,
'name' => 'Sonstige'
]);
}
private function installParticipationFeeTypes() {
ParticipationFeeType::create(['slug' => ParticipationFeeType::PARTICIPATION_FEE_TYPE_SOLIDARITY, 'name' => 'Solidaritätsprinzip']);
ParticipationFeeType::create(['slug' => ParticipationFeeType::PARTICIPATION_FEE_TYPE_FIXED, 'name' => 'Festpreis']);
}
private function installUserRoles() {
UserRole::create(['name' => 'Administrator*in', 'slug' => UserRole::USER_ROLE_ADMIN]);
UserRole::create(['name' => 'Vorstandsmitglied', 'slug' => UserRole::USER_ROLE_GROUP_LEADER]);
UserRole::create(['name' => 'Benutzer*in', 'slug' => UserRole::USER_ROLE_USER]);
}
private function installSwimmingPermissions() {
SwimmingPermission::create(['name' => 'Mein Kind darf baden und kann schwimmen', 'slug' => SwimmingPermission::SWIMMING_PERMISSION_ALLOWED, 'short' => 'Erteilt']);
SwimmingPermission::create(['name' => 'Mein Kind darf baden und kann NICHT schwimmen', 'slug' => SwimmingPermission::SWIMMING_PERMISSION_LIMITED, 'short' => 'Nur Flachwasser']);
SwimmingPermission::create(['name' => 'Mein Kind darf nicht baden', 'slug' => SwimmingPermission::SWIMMING_PERMISSION_DENIED, 'short' => 'Verweiger']);
}
private function installEatingHabits() {
EatingHabit::create(['name' => 'Vegan', 'slug' => EatingHabit::EATING_HABIT_VEGAN]);
EatingHabit::create(['name' => 'Vegetarisch', 'slug' => EatingHabit::EATING_HABIT_VEGETARIAN]);
EatingHabit::create(['name' => 'Omnivor', 'slug' => EatingHabit::EATING_HABIT_OMNIVOR]);
}
private function installFirstAidPermissions() {
FirstAidPermission::create([
'name' => 'Zugestimmt',
'description' => 'Ich STIMME der Anwendung von erweiteren Erste-Hilfe-Maßnahmen an meinem Kind explizit ZU.',
'slug' => FirstAidPermission::FIRST_AID_PERMISSION_ALLOWED]);
FirstAidPermission::create([
'name' => 'Verweigert',
'description' => 'Ich LEHNE die Anwendung von erweiteren Erste-Hilfe-Maßnahmen an meinem Kind explizit AB.',
'slug' => FirstAidPermission::FIRST_AID_PERMISSION_DENIED]);
}
private function installCostUnitTypes() {
CostUnitType::create(['slug' => CostUnitType::COST_UNIT_TYPE_EVENT, 'name' => 'Veranstaltung']);
CostUnitType::create(['slug' => CostUnitType::COST_UNIT_TYPE_RUNNING_JOB, 'name' => 'Laufende Tätigkeit']);
}
private function installInvoiceMetaData() {
// `purchase_example` steht im Formular als Beispiel im Feld "Was wurde eingekauft" und ist dort
// Pflicht. Der Text hängt an der Ausgabenart, weil ein allgemeines "z. B. Material" beim
// Ausfüllen nicht weiterhilft; pflegen lässt er sich anschließend in der Tabelle.
InvoiceType::create([
'slug' => InvoiceType::INVOICE_TYPE_TRAVELLING,
'name' => 'Reisekosten',
'purchase_example' => 'z. B. Bahnfahrt HalleLeipzig',
]);
InvoiceType::create([
'slug' => InvoiceType::INVOICE_TYPE_PROGRAM,
'name' => 'Programmkosten',
'purchase_example' => 'z. B. Bastelmaterial für den Workshop',
]);
InvoiceType::create([
'slug' => InvoiceType::INVOICE_TYPE_ACCOMMODATION,
'name' => 'Unterkunftskosten',
'purchase_example' => 'z. B. zwei Nächte Jugendherberge',
]);
InvoiceType::create([
'slug' => InvoiceType::INVOICE_TYPE_CATERING,
'name' => 'Verpflegungskosten',
'purchase_example' => 'z. B. Wocheneinkauf für das Frühstück',
]);
InvoiceType::create([
'slug' => InvoiceType::INVOICE_TYPE_OTHER,
'name' => 'Sonstige Kosten',
'purchase_example' => 'z. B. Erste-Hilfe-Set',
]);
InvoiceStatus::create(['slug' => InvoiceStatus::INVOICE_STATUS_NEW]);
InvoiceStatus::create(['slug' => InvoiceStatus::INVOICE_STATUS_APPROVED]);
InvoiceStatus::create(['slug' => InvoiceStatus::INVOICE_STATUS_EXPORTED]);
InvoiceStatus::create(['slug' => InvoiceStatus::INVOICE_STATUS_DENIED]);
InvoiceStatus::create(['slug' => InvoiceStatus::INVOICE_STATUS_DELETED]);
}
private function installCronTypes() {
CronTaskType::create(['slug' => CronTaskType::CRON_TASK_TYPE_REALTIME]);
CronTaskType::create(['slug' => CronTaskType::CRON_TASK_TYPE_DAILY]);
}
}