52 خطوط
1.3 KiB
PHP
52 خطوط
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
|
|
|
class Meeting extends Model
|
|
{
|
|
protected $fillable = [
|
|
'title', 'project_id', 'date', 'start_time', 'end_time', 'location',
|
|
'meeting_link', 'meeting_type', 'agenda', 'notes', 'decisions', 'created_by'
|
|
];
|
|
|
|
protected $casts = [
|
|
'date' => 'date',
|
|
];
|
|
|
|
public function project(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Project::class);
|
|
}
|
|
|
|
public function creator(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class, 'created_by');
|
|
}
|
|
|
|
public function participants(): BelongsToMany
|
|
{
|
|
return $this->belongsToMany(User::class, 'meeting_user')->withTimestamps();
|
|
}
|
|
|
|
public function actionItems(): HasMany
|
|
{
|
|
return $this->hasMany(MeetingActionItem::class);
|
|
}
|
|
|
|
public function comments(): MorphMany
|
|
{
|
|
return $this->morphMany(Comment::class, 'commentable');
|
|
}
|
|
|
|
public function files(): MorphMany
|
|
{
|
|
return $this->morphMany(File::class, 'fileable');
|
|
}
|
|
}
|