- Fix EventType deletion error handling (constraint violations) - Fix Event update error (package_id column missing) - Fix Event Type dropdown options (JSON display issue) - Fix EventPackagesRelationManager query error - Add missing translations for deletion errors - Apply Pint formatting
33 lines
711 B
PHP
33 lines
711 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
class EventType extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $table = 'event_types';
|
|
|
|
protected $guarded = [];
|
|
|
|
protected $casts = [
|
|
'name' => 'array',
|
|
'settings' => 'array',
|
|
];
|
|
|
|
public function emotions(): BelongsToMany
|
|
{
|
|
return $this->belongsToMany(Emotion::class, 'emotion_event_type', 'event_type_id', 'emotion_id');
|
|
}
|
|
|
|
public function events(): HasMany
|
|
{
|
|
return $this->hasMany(Event::class);
|
|
}
|
|
}
|