32 lines
710 B
PHP
32 lines
710 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 Emotion extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $table = 'emotions';
|
|
protected $guarded = [];
|
|
protected $casts = [
|
|
'name' => 'array',
|
|
'description' => 'array',
|
|
];
|
|
|
|
public function eventTypes(): BelongsToMany
|
|
{
|
|
return $this->belongsToMany(EventType::class, 'emotion_event_type', 'emotion_id', 'event_type_id');
|
|
}
|
|
|
|
public function tasks(): HasMany
|
|
{
|
|
return $this->hasMany(Task::class);
|
|
}
|
|
}
|
|
|