public function post_index() { $users = Users\Model\User::select('*')->order_by('created_at', 'DESC'); $group = Input::get('f_group'); $status = Input::get('f_status'); $search = Input::get('f_keywords'); if (isset($group) and $group != '0' and !empty($group)) { $users->where('group_id', '=', $group); } if (isset($status) and $status != '0' and !empty($status)) { $users->where('status', '=', $status); } if (isset($search) and !empty($search)) { $users->where('avatar_first_name', 'LIKE', '%' . $search . '%'); $users->or_where('avatar_last_name', 'LIKE', '%' . $search . '%'); $users->or_where('email', 'LIKE', '%' . $search . '%'); } $users = $users->paginate(Config::get('settings::core.records_per_page')); $this->data['users'] = $users->results; $this->data['pagination_links'] = $users->links(); return View::make('users::backend.partials._users_list', $this->data); }
public function post_get_users() { $status = Input::get('status'); $group = Input::get('group'); $users = Users\Model\User::select('*'); if (isset($group) and $group != '0' and !empty($group)) { $users->where('group_id', '=', $group); } if (isset($status) and $status != '0' and !empty($status)) { $users->where('status', '=', $status); } $users = $users->get(array('email', 'avatar_first_name', 'avatar_last_name')); $response = array(); // We need to build the array for response foreach ($users as $user) { $response[$user->email] = $user->avatar_first_name . ' ' . $user->avatar_last_name; } return json_encode($response); }