Skip to content

Commit

Permalink
修改 “通过查询来删除模型”小节
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangbao committed Jan 11, 2017
1 parent 2b63ea5 commit 41a1646
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions eloquent.md
Expand Up @@ -407,15 +407,12 @@ Eloquent 的 `all` 方法会返回在模型数据表中的所有结果。由于

#### 通过查询来删除模型

当然,你也可以在一组模型上运行删除查询。在这个例子中,我们将会删除所有被标示为不活跃的航班:

$deletedRows = App\Flight::where('active', 0)->delete();

In this example, we will delete all flights that are marked as inactive. Like mass updates, mass deletes will not fire any model events for the models that are deleted:
当然,你也可以运行在一组模型删除查询。在这个例子中,我们会删除被标记为不活跃的所有航班。 像批量更新那样,批量删除不会删除的任何被删除的模型的事件:

$deletedRows = App\Flight::where('active', 0)->delete();

>{note} 当使用 Eloquent 批量删除语句时,`deleting``deleted` 模型事件不会在被删除模型实例上触发。因为删除语句执行时,不会检索回模型实例。
<a name="soft-deleting"></a>
### 软删除

Expand Down

0 comments on commit 41a1646

Please sign in to comment.