Skip to content

Commit 517affd

Browse files
Bugfix/CUR-1950 team project deletion (ActiveLearningStudio#513)
* PR review fixing * CUR-1201 fixing * CUR-1203 and CUR-1201 fixing * CUR-1950 issue fixing
1 parent a3f5ffc commit 517affd

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Diff for: app/Models/Team.php

+14
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,20 @@ public function invitedUsers()
4141
return $this->hasMany('App\Models\InvitedTeamUser', 'team_id');
4242
}
4343

44+
/**
45+
* Cascade on delete the team
46+
*/
47+
public static function boot()
48+
{
49+
parent::boot();
50+
51+
self::deleting(function (Team $team) {
52+
foreach ($team->projects as $project) {
53+
$project->delete();
54+
}
55+
});
56+
}
57+
4458
/**
4559
* Get the projects for the team
4660
*/

0 commit comments

Comments
 (0)