Repository navigation
Replies: 2 comments
|
@nspaul Did you solve your problem? I'm facing a similar issue... |
0 replies
|
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 |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
When I return a User object (specifically, a
LdapRecord\Models\ActiveDirectory\Userobject), 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
givennameattribute that is in both theoriginalarray and theattributesarray: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.
All reactions