Skip to content

Commit b81fdd7

Browse files
[7.x] Add setNullOnDelete in ForeignKeyDefinition (#33551)
* [7.x] Add setNullOnDelete in ForeignKeyDefinition Signed-off-by: Lloric Mayuga Garcia <[email protected]> * Update ForeignKeyDefinition.php Co-authored-by: Taylor Otwell <[email protected]>
1 parent a459b9b commit b81fdd7

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/Illuminate/Database/Schema/ForeignKeyDefinition.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,14 @@ public function cascadeOnDelete()
3333
{
3434
return $this->onDelete('cascade');
3535
}
36+
37+
/**
38+
* Indicate that deletes should set the foreign key value to null.
39+
*
40+
* @return $this
41+
*/
42+
public function nullOnDelete()
43+
{
44+
return $this->onDelete('set null');
45+
}
3646
}

0 commit comments

Comments
 (0)