/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { $users = \Adldap::users()->search()->orWhere('samaccountname', '=', $id)->orWhere('cn', 'contains', $id)->orWhere('title', 'contains', $id)->orWhere('department', 'contains', $id)->orWhere('memberof', '=', $id)->get(); //->orWhere('samaccountname','=',$id)->get(); $data = []; foreach ($users as $user) { $temp = $user->jsonSerialize(); $temp['is_active'] = $user->isActive(); $temp['is_enabled'] = $user->isEnabled(); $data[] = $temp; } $return = ["class" => "User", "query" => $id, "from" => 1, "to" => $users->count(), "total" => $users->count(), "data" => $data]; return response()->json($return, 200); }
/** * Returns a new Adldap user query. * * @return \Adldap\Query\Builder */ protected function newLdapUserQuery() { return Adldap::search()->select($this->getSelectAttributes()); }