136 lines
3.0 KiB
PHP
136 lines
3.0 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Casts\AmountCast;
|
|
use App\Enumerations\EatingHabit;
|
|
use App\Enumerations\EfzStatus;
|
|
use App\Enumerations\FirstAidPermission;
|
|
use App\Enumerations\ParticipationType;
|
|
use App\Enumerations\SwimmingPermission;
|
|
use App\Scopes\InstancedModel;
|
|
use Illuminate\Database\Eloquent\Builder;
|
|
|
|
|
|
class EventParticipant extends InstancedModel
|
|
{
|
|
protected $table = 'event_participants';
|
|
|
|
protected $fillable = [
|
|
'tenant',
|
|
'event_id',
|
|
'user_id',
|
|
|
|
'firstname',
|
|
'lastname',
|
|
'nickname',
|
|
|
|
'participation_type',
|
|
'local_group',
|
|
'birthday',
|
|
|
|
'address_1',
|
|
'address_2',
|
|
'postcode',
|
|
'city',
|
|
|
|
'email_1',
|
|
'phone_1',
|
|
'email_2',
|
|
'phone_2',
|
|
'contact_person',
|
|
|
|
'allergies',
|
|
'intolerances',
|
|
'eating_habits',
|
|
'swimming_permission',
|
|
'first_aid_permission',
|
|
|
|
'foto_socialmedia',
|
|
'foto_print',
|
|
'foto_webseite',
|
|
'foto_partner',
|
|
'foto_intern',
|
|
|
|
'arrival_date',
|
|
'departure_date',
|
|
'arrival_eating',
|
|
'departure_eating',
|
|
|
|
'notes',
|
|
'amount',
|
|
'amount_paid',
|
|
'efz_status',
|
|
'unregistered_at',
|
|
];
|
|
|
|
protected $casts = [
|
|
'birthday' => 'datetime',
|
|
'arrival_date' => 'datetime',
|
|
'departure_date' => 'datetime',
|
|
'unregistered_at' => 'datetime',
|
|
|
|
'foto_socialmedia' => 'boolean',
|
|
'foto_print' => 'boolean',
|
|
'foto_webseite' => 'boolean',
|
|
'foto_partner' => 'boolean',
|
|
'foto_intern' => 'boolean',
|
|
|
|
'amount' => AmountCast::class,
|
|
'amount_paid' => AmountCast::class,
|
|
];
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Relationships
|
|
|--------------------------------------------------------------------------
|
|
*/
|
|
|
|
public function event()
|
|
{
|
|
return $this->belongsTo(Event::class);
|
|
}
|
|
|
|
public function user()
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
|
|
public function tenantRelation()
|
|
{
|
|
return $this->belongsTo(Tenant::class, 'tenant', 'slug');
|
|
}
|
|
|
|
public function localGroup()
|
|
{
|
|
return $this->belongsTo(Tenant::class, 'local_group', 'slug');
|
|
}
|
|
|
|
public function participationType()
|
|
{
|
|
return $this->belongsTo(ParticipationType::class, 'participation_type', 'slug');
|
|
}
|
|
|
|
public function swimmingPermission()
|
|
{
|
|
return $this->belongsTo(SwimmingPermission::class, 'swimming_permission', 'slug');
|
|
}
|
|
|
|
public function eatingHabit()
|
|
{
|
|
return $this->belongsTo(EatingHabit::class, 'eating_habits', 'slug');
|
|
}
|
|
|
|
public function firstAidPermission()
|
|
{
|
|
return $this->belongsTo(FirstAidPermission::class, 'first_aid_permission', 'slug');
|
|
}
|
|
|
|
public function efzStatus()
|
|
{
|
|
return $this->belongsTo(EfzStatus::class, 'efz_status', 'slug');
|
|
}
|
|
|
|
|
|
}
|