28 lines
770 B
PHP
28 lines
770 B
PHP
<?php
|
|
|
|
namespace Modules\Events\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
final class Event extends Model
|
|
{
|
|
protected $fillable = ['venue_id', 'title', 'slug', 'summary', 'description', 'starts_at', 'ends_at', 'status', 'capacity', 'price', 'registration_open'];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return ['starts_at' => 'datetime', 'ends_at' => 'datetime', 'price' => 'decimal:2', 'registration_open' => 'boolean'];
|
|
}
|
|
|
|
public function venue(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Venue::class);
|
|
}
|
|
|
|
public function registrations(): HasMany
|
|
{
|
|
return $this->hasMany(Registration::class);
|
|
}
|
|
}
|