Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/284.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Laravel LdapRecord阵列_Php_Laravel_Active Directory_Ldap_Laravel Livewire - Fatal编程技术网

Php Laravel LdapRecord阵列

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:

在一个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: 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;