Replies: 2 comments
-
@nspaul Did you solve your problem? I'm facing a similar issue... |
Beta Was this translation helpful? Give feedback.
-
Hi @nspaul, apologies for the late reply on this issue. This is intended behaviour. PHP will return all LDAP attributes as arrays, regardless if it's multi-value, or single-value. It has no knowledge of attributes and their behaviour, so it's impossible for it to decisively return which attributes as single-values. LdapRecord includes a $user = User::findBy('cn', 'John Doe');
$name = $user->getFirstAttribute('givenname'); In Blade: {{ $user->getFirstAttribute('givenname') }} This is described in the documentation here: https://ldaprecord.com/docs/core/v2/models/#array-conversion |
Beta Was this translation helpful? Give feedback.
-
When I return a User object (specifically, a
LdapRecord\Models\ActiveDirectory\User
object), I am wondering why all of the user's attributes come in as an array. Is this the expected behavior?As an example, when I use LdapRecord and query for my own user, here is the
givenname
attribute that is in both theoriginal
array and theattributes
array:I'm just trying to figure out the proper way to search for a user and then send that user object into a Blade view, and then within that Blade view I want to be able to display a variety of user attributes on the screen, using something like
{{ $user->givenname }}
Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions