Skip to content

Commit 5e6d0c2

Browse files
committed
wip
1 parent 2494366 commit 5e6d0c2

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

‎eloquent.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -879,7 +879,7 @@ $user->getOriginal('name'); // John
879879
$user->getOriginal(); // Array of original attributes...
880880
```
881881

882-
The `getChanges` method returns an array containing the attributes that changed when the model was last saved:
882+
The `getChanges` method returns an array containing the attributes that changed when the model was last saved, while the `getPrevious` method returns an array containing the original attribute values before the model was last saved:
883883

884884
```php
885885
$user = User::find(1);
@@ -900,6 +900,15 @@ $user->getChanges();
900900
'email' => 'jack@example.com',
901901
]
902902
*/
903+
904+
$user->getPrevious();
905+
906+
/*
907+
[
908+
'name' => 'John',
909+
'email' => 'john@example.com',
910+
]
911+
*/
903912
```
904913

905914
<a name="mass-assignment"></a>

0 commit comments

Comments
 (0)