Php Laravel LdapRecord阵列
在一个Lravel项目中,我正在学习Laravel,我使用了以下方法:Php Laravel LdapRecord阵列,php,laravel,active-directory,ldap,laravel-livewire,Php,Laravel,Active Directory,Ldap,Laravel Livewire,在一个Lravel项目中,我正在学习Laravel,我使用了以下方法: PHP v7.4.3 拉威尔v8.12.3 Livewire v2.3.1 目录树/ldaprecord v1.12.0 查询目录后,我将返回一个类似于他的数组: LdapRecord\Query\Collection {#1403 ▼ #items: array:5 [▼ 0 => LdapRecord\Models\ActiveDirectory\Entry {#1405 ▼ +exists:
- PHP v7.4.3
- 拉威尔v8.12.3
- Livewire v2.3.1
- 目录树/ldaprecord v1.12.0
LdapRecord\Query\Collection {#1403 ▼
#items: array:5 [▼
0 => LdapRecord\Models\ActiveDirectory\Entry {#1405 ▼
+exists: true
#dn: "CN=John Doe,DC=amce,DC=local"
#in: null
#connection: null
#guidKey: "objectguid"
#modifications: []
#original: array:85 [▶]
#attributes: array:85 [▼
"objectclass" => array:4 [▶]
"cn" => array:1 [▼
0 => "John Doe"
]
"sn" => array:1 [▶]
"c" => array:1 [▶]
"l" => array:1 [▶]
"title" => array:1 [▶]
"description" => array:1 [▶]
...
]
#dates: []
#casts: []
#dateFormat: null
#defaultDates: array:2 [▶]
#hidden: []
#visible: []
}
1 => LdapRecord\Models\ActiveDirectory\Entry {#1406 ▶}
2 => LdapRecord\Models\ActiveDirectory\Entry {#1407 ▶}
...
]
}
如何访问livewire组件中用户的active directory属性(例如cn或title)?
我希望能够显示用户作为一个可搜索的表,也许在未来添加crud功能
非常感谢你的帮助
$user = Auth::user();
$user->getFirstAttribute('cn')
我用的是laravel 8,这对我很有效
下面我将向你们展示我是如何获得这些群体的
$user = Auth::user();
$groups = Auth::user()->memberof;