Reputation: 30906
I put a breakpoint inside a function in my model in Laravel 4.
I see on $this
there is both attributes and original.
Both seem to contain the same data, i.e. a key/value pair representing fields in the table.
What's the difference?
I need a function in my model that will return all the fields as an associative array, which one do I use?
Upvotes: 5
Views: 3719
Reputation: 87769
They have the same data until you change any of your attributes:
$user->name = "user391986";
Then you'll have
$user->attributes['name'] != $user->original['name'];
Upvotes: 6