public function getIndex($id) { $countries = Countries::getList('en', 'json', 'cldr'); $roles = $this->roleRepo->findByAppId($id); $this->layout->content = View::make('notifications.index')->with('roles', dropdownFormat($roles))->with('appId', $id)->with('countries', json_decode($countries)); $app = $this->appRepo->findById($id); $this->layout->sidebarLeft = View::make('sidebars.app')->with('app', $app); return $this->layout; }
public function getUsers($roleId) { $role = $this->roleRepo->findById($roleId); try { $users = $role->users()->paginate(10); } catch (exception $e) { $users = array(); } try { $allUsers = $role->merchant->users; } catch (exception $e) { $allUsers = array(); } //excluding users who are already in the list $dropdownAllUsers = dropdownFormat($allUsers); $filteredUsers = $dropdownAllUsers; if (!empty($users)) { $dropdownUser = dropdownFormat($users); $filteredUsers = count($dropdownAllUsers) > count($dropdownUser) ? array_diff($dropdownAllUsers, $dropdownUser) : array_diff($dropdownUser, $dropdownAllUsers); } $this->layout->content = View::make('roles.users')->with('role', $role)->with('users', $users)->with('filteredUsers', $filteredUsers); return $this->layout; }