Handling of event addons
This commit is contained in:
+13
-3
@@ -8,14 +8,11 @@ use App\Enumerations\EatingHabit;
|
||||
use App\Enumerations\ParticipationFeeType;
|
||||
use App\RelationModels\EventParticipationFee;
|
||||
use App\RelationModels\EventPaymentMethods;
|
||||
use App\Resources\EventResource;
|
||||
use App\Scopes\CommonModel;
|
||||
use App\Scopes\InstancedModel;
|
||||
use DateTime;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
/**
|
||||
* @property string $tenant
|
||||
@@ -85,6 +82,13 @@ class Event extends InstancedModel
|
||||
'support_flat',
|
||||
'alcoholics_age',
|
||||
'archived',
|
||||
'tax_liable',
|
||||
'vat_rate',
|
||||
'vat_pricing_mode',
|
||||
'tax_exemption_reason',
|
||||
'tax_exemption_note',
|
||||
'participation_options',
|
||||
'addons',
|
||||
|
||||
];
|
||||
|
||||
@@ -109,6 +113,12 @@ class Event extends InstancedModel
|
||||
'total_max_amount' => AmountCast::class,
|
||||
|
||||
'sibling_reduction' => 'boolean',
|
||||
|
||||
'tax_liable' => 'boolean',
|
||||
'vat_rate' => 'integer',
|
||||
|
||||
'participation_options' => 'array',
|
||||
'addons' => 'array',
|
||||
];
|
||||
|
||||
public function tenant(): BelongsTo
|
||||
|
||||
@@ -14,6 +14,7 @@ use App\EventPaymentModules\DTO\RegistrationSummaryResponse;
|
||||
use App\EventPaymentModules\EventPaymentModule;
|
||||
use App\EventPaymentModules\EventPaymentModuleRegistry;
|
||||
use App\Scopes\InstancedModel;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
|
||||
class EventParticipant extends InstancedModel
|
||||
@@ -103,6 +104,18 @@ class EventParticipant extends InstancedModel
|
||||
return $this->belongsTo(Event::class);
|
||||
}
|
||||
|
||||
/** Gewählte Teilnahmeoptionen (event-spezifische Pflicht-Auswahl) dieser Anmeldung. */
|
||||
public function selectedOptions(): HasMany
|
||||
{
|
||||
return $this->hasMany(EventParticipantOption::class, 'event_participant_id');
|
||||
}
|
||||
|
||||
/** Gebuchte Zusätze (Event-Addons) dieser Anmeldung. */
|
||||
public function selectedAddons(): HasMany
|
||||
{
|
||||
return $this->hasMany(EventParticipantAddon::class, 'event_participant_id');
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Casts\AmountCast;
|
||||
use App\Scopes\InstancedModel;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class EventParticipantAddon extends InstancedModel
|
||||
{
|
||||
protected $table = 'event_participant_addons';
|
||||
|
||||
protected $fillable = [
|
||||
'tenant',
|
||||
'event_id',
|
||||
'event_participant_id',
|
||||
'addon_key',
|
||||
'title',
|
||||
'price',
|
||||
'flat',
|
||||
'days',
|
||||
'amount',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'flat' => 'boolean',
|
||||
'days' => 'integer',
|
||||
'price' => AmountCast::class,
|
||||
'amount' => AmountCast::class,
|
||||
];
|
||||
|
||||
public function event(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Event::class);
|
||||
}
|
||||
|
||||
public function participant(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(EventParticipant::class, 'event_participant_id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Scopes\InstancedModel;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class EventParticipantOption extends InstancedModel
|
||||
{
|
||||
protected $table = 'event_participant_options';
|
||||
|
||||
protected $fillable = [
|
||||
'tenant',
|
||||
'event_id',
|
||||
'event_participant_id',
|
||||
'question_key',
|
||||
'question_label',
|
||||
'value',
|
||||
'value_label',
|
||||
];
|
||||
|
||||
public function event(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Event::class);
|
||||
}
|
||||
|
||||
public function participant(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(EventParticipant::class, 'event_participant_id');
|
||||
}
|
||||
}
|
||||
+16
-1
@@ -21,6 +21,11 @@ use App\Scopes\CommonModel;
|
||||
* @property string $url_participation_rules
|
||||
* @property boolean $events_allowed
|
||||
* @property boolean $has_active_instance
|
||||
* @property boolean $tax_liable
|
||||
* @property int $vat_rate
|
||||
* @property string|null $tax_exemption_reason
|
||||
* @property string|null $tax_exemption_note
|
||||
* @property string $vat_pricing_mode
|
||||
*/
|
||||
class Tenant extends CommonModel
|
||||
{
|
||||
@@ -46,6 +51,16 @@ class Tenant extends CommonModel
|
||||
'impress_text',
|
||||
'url_participation_rules',
|
||||
'is_active_local_group',
|
||||
'has_active_instance'
|
||||
'has_active_instance',
|
||||
'tax_liable',
|
||||
'vat_rate',
|
||||
'tax_exemption_reason',
|
||||
'tax_exemption_note',
|
||||
'vat_pricing_mode',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'tax_liable' => 'boolean',
|
||||
'vat_rate' => 'integer',
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user