42 lines
830 B
PHP
42 lines
830 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
|
|
|
class TaskCollection extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $table = 'task_collections';
|
|
|
|
protected $fillable = [
|
|
'tenant_id',
|
|
'name',
|
|
'description',
|
|
];
|
|
|
|
public function tasks(): BelongsToMany
|
|
{
|
|
return $this->belongsToMany(
|
|
Task::class,
|
|
'task_collection_task',
|
|
'task_collection_id',
|
|
'task_id'
|
|
);
|
|
}
|
|
|
|
public function events(): BelongsToMany
|
|
{
|
|
return $this->belongsToMany(
|
|
Event::class,
|
|
'event_task_collection',
|
|
'task_collection_id',
|
|
'event_id'
|
|
);
|
|
}
|
|
}
|
|
|