mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 22:39:34 +00:00
GET mastertasks, GET mastertasks/{id} endpointy
This commit is contained in:
1 parent
dfac41f30a
commit
ba6b9e20a5
16 files changed
+210
-12
No files matched your search
@@ -11,8 +11,8 @@ class Attachment extends Model
|
||||
|
||||
public $timestamps = true;
|
||||
|
||||
public function subtask()
|
||||
public function mastertask()
|
||||
{
|
||||
return $this->belongsTo(SubTask::class);
|
||||
return $this->belongsTo(MasterTask::class, 'master_task_id');
|
||||
}
|
||||
}
|
||||
@@ -30,4 +30,14 @@ class MasterTask extends Model
|
||||
{
|
||||
return $this->belongsTo(Team::class);
|
||||
}
|
||||
|
||||
// vracia userov, ktori su priradeni k subtasku ale nepatria do teamu
|
||||
public function getUsersOutsideTeamAttribute()
|
||||
{
|
||||
$users = $this->subtasks->pluck('user')->unique();
|
||||
|
||||
return $users->filter(function ($user) {
|
||||
return !in_array($this->team->id, $user->teams->pluck('id')->unique()->toArray());
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,6 @@ class Project extends Model
|
||||
|
||||
public function mastertasks()
|
||||
{
|
||||
return $this->hasMany(MasterTask::class);
|
||||
return $this->hasMany(MasterTask::class, 'master_task_id');
|
||||
}
|
||||
}
|
||||
@@ -13,12 +13,12 @@ class SubTask extends Model
|
||||
|
||||
public function mastertask()
|
||||
{
|
||||
return $this->belongsTo(MasterTask::class);
|
||||
return $this->belongsTo(MasterTask::class, 'master_task_id');
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(MasterTask::class);
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
public function timeblocks()
|
||||
|
||||
@@ -13,6 +13,6 @@ class Timeblock extends Model
|
||||
|
||||
public function subtask()
|
||||
{
|
||||
return $this->belongsTo(SubTask::class);
|
||||
return $this->belongsTo(SubTask::class, 'sub_task_id');
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ class Timesheet extends Model
|
||||
|
||||
public function subtask()
|
||||
{
|
||||
return $this->belongsTo(SubTask::class);
|
||||
return $this->belongsTo(SubTask::class, 'sub_task_id');
|
||||
}
|
||||
|
||||
public function user()
|
||||
|
||||
Reference in new issue
Block a user