Fix task collection attach relation
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled
tests / ui (push) Has been cancelled

This commit is contained in:
Codex Agent
2026-01-19 21:33:38 +01:00
parent 802e360c8e
commit 42f6178b6d
3 changed files with 31 additions and 0 deletions

View File

@@ -19,6 +19,8 @@ class TasksRelationManager extends RelationManager
{
protected static string $relationship = 'tasks';
protected static ?string $inverseRelationship = 'taskCollections';
public function table(Table $table): Table
{
return $table

View File

@@ -44,6 +44,16 @@ class Task extends Model
return $this->belongsTo(TaskCollection::class, 'collection_id');
}
public function taskCollections(): BelongsToMany
{
return $this->belongsToMany(
TaskCollection::class,
'task_collection_task',
'task_id',
'task_collection_id'
)->withPivot(['sort_order']);
}
public function tenant(): BelongsTo
{
return $this->belongsTo(Tenant::class);