Skip to content

Commit 1090c55

Browse files
committed
Tweaking notes.
1 parent 6f35b8c commit 1090c55

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

eloquent.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,9 @@ To create a new record in the database from a model, simply create a new model i
154154
155155
You may also use the `create` method to save a new model in a single line. The inserted model instance will be returned to you from the method. However, before doing so, you will need to specify either a `fillable` or `guarded` attribute on the model, as all Eloquent models protect against mass-assignment.
156156

157-
After saving or creating a new model, you can access its inserted ID simply by getting the object's `id` attribute - in the example above, `$user->id`.
157+
After saving or creating a new model that uses auto-incrementing IDs, you may retrieve the ID by accessing the object's `id` attribute:
158+
159+
$insertedId = $user->id;
158160

159161
**Setting The Guarded Attributes On The Model**
160162

0 commit comments

Comments
 (0)