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:
parent
1db67d47a3
commit
c60a58ff26
|
@ -15,6 +15,7 @@ ## Contents
|
|||
- [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 @@ #### Excluding attributes from the array:
|
|||
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.
|
Loading…
Reference in New Issue