We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a3f5ffc commit 517affdCopy full SHA for 517affd
app/Models/Team.php
@@ -41,6 +41,20 @@ public function invitedUsers()
41
return $this->hasMany('App\Models\InvitedTeamUser', 'team_id');
42
}
43
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
58
/**
59
* Get the projects for the team
60
*/
0 commit comments