Level 11
Models does implements ArrayAccess interface. You can read more about it at http://php.net/manual/en/class.arrayaccess.php
2 likes
Example:
$user = \App\User::find(1);
echo $user->id; // 1
echo $user['id']; // 1
I did not know the array-like syntax. Is there some documentation on this? How is this magic called?
Models does implements ArrayAccess interface. You can read more about it at http://php.net/manual/en/class.arrayaccess.php
Please or to participate in this conversation.