Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion database/relations.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Argument | Description
`scope` | filters the relation using a supplied scope method.
`push` | if set to false, this relation will not be saved via `push`, default: true.
`delete` | if set to true, the related model will be deleted if the primary model is deleted or relationship is destroyed, default: false.
`detach` | if set to false the related model will not be automatically detached if the primary model is deleted or the relationship is destroyed. Used by `belongsToMany` relationships only, default: true.
`detach` | if set to false the related model will not be automatically detached if the primary model is deleted or the relationship is destroyed. Used by `belongsToMany`, `morphToMany` and `morphedByMany` relationships only, default: true.
`count` | if set to true, the result contains a `count` column only, used for counting relations, default: false.

Example filter using **order** and **conditions**:
Expand Down
1 change: 1 addition & 0 deletions database/traits.md
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,7 @@ class User extends Model
}
```

> **NOTE:** If the soft deleting relation is using a pivot table, you can set the `deletedAtColumn` option on the relation definition to change the column that will hold the soft deletion date in the pivot table, otherwise, it defaults to `deleted_at`.
> **NOTE:** If the related model does not use the soft delete trait, it will be treated the same as the `delete` option and deleted permanently.

Under these same conditions, when the primary model is restored, all the related models that use the `softDelete` option will also be restored.
Expand Down