Someone else can re-word this, but a easy-to-find paragraph on deleteing Eloquent models seemed missing.
Signed-off-by: Colin Viebrock <colin@viebrock.ca>
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
- [Setter & Getter Methods](#getter-and-setter-methods)
|
||||
- [Mass-Assignment](#mass-assignment)
|
||||
- [Converting Models To Arrays](#to-array)
|
||||
- [Deleting Models](#delete)
|
||||
|
||||
<a name="the-basics"></a>
|
||||
## The Basics
|
||||
@@ -537,3 +538,12 @@ Sometimes you may wish to limit the attributes that are included in your model's
|
||||
public static $hidden = array('password');
|
||||
|
||||
}
|
||||
|
||||
<a name="delete"></a>
|
||||
## Deleting Models
|
||||
|
||||
Because Eloquent inherits all the features and methods of Fluent queries, deleting models is a snap:
|
||||
|
||||
$author->delete();
|
||||
|
||||
Note, however, than this won't delete any related models (e.g. all the author's Book models will still exist), unless you have set up [foreign keys](/docs/database/schema#foreign-keys) and cascading deletes.
|
||||
Reference in New Issue
Block a user