Event addons bookable
This commit is contained in:
@@ -88,6 +88,7 @@ class Event extends InstancedModel
|
||||
'tax_exemption_reason',
|
||||
'tax_exemption_note',
|
||||
'participation_options',
|
||||
'addons',
|
||||
|
||||
];
|
||||
|
||||
@@ -117,6 +118,7 @@ class Event extends InstancedModel
|
||||
'vat_rate' => 'integer',
|
||||
|
||||
'participation_options' => 'array',
|
||||
'addons' => 'array',
|
||||
];
|
||||
|
||||
public function tenant(): BelongsTo
|
||||
|
||||
@@ -110,6 +110,12 @@ class EventParticipant extends InstancedModel
|
||||
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');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user