Handle the Add Role AJAX

@param $params

@return mixed|void
547986
public function ajax_add( $params ) {

		global $wp_roles;

		$role_name  = pods_var_raw( 'role_name', $params );
		$role_label = pods_var_raw( 'role_label', $params );

		$params->capabilities = (array) pods_var_raw( 'capabilities', $params, array() );

		$params->custom_capabilities = (array) pods_var_raw( 'custom_capabilities', $params, array() );
		$params->custom_capabilities = array_filter( array_unique( $params->custom_capabilities ) );

		$capabilities = array();

		foreach ( $params->capabilities as $capability => $x ) {
			if ( empty( $capability ) || true !== (boolean) $x ) {
				continue;
			}

			$capabilities[ esc_attr( $capability ) ] = true;
		}

		foreach ( $params->custom_capabilities as $x => $capability ) {
			if ( empty( $capability ) || '--1' === $x ) {
				continue;
			}

			$capabilities[ esc_attr( $capability ) ] = true;
		}

		if ( empty( $role_name ) ) {
			return pods_error( __( 'Role name is required', 'pods' ) );
		}

		if ( empty( $role_label ) ) {
			return pods_error( __( 'Role label is required', 'pods' ) );
		}

		return add_role( $role_name, $role_label, $capabilities );
	}
424019
function add(array $parameters): void
    {
        foreach ($parameters as $parameter => $value) {
            $this->query[$parameter] = $value;
        }
    }
759520
public function push($params)
    {
        foreach ($params as $key => $value) {
            array_set($this->params, $key, $value);
        }
        return $this;
    }
475531
protected function actionAdd($params=array())
    {
        $response = array(
            'errors' => array(),
            'data' => array(),
        );
        $values = $this->company->prepareParams($params);

        if (empty($values['name'])) {
            $response['errors'][] = 'cmp01';
        }
        if (empty($values['build'])) {
            $response['errors'][] = 'cmp02';
        }
        if (!$this->checkBuildExists($values['build'])) {
            $response['errors'][] = 'cmp03';
        }
        if ($this->checkCompanyExists($values['id'])) {
            $response['errors'][] = 'cmp04';
            $response['data']['id'] = $values['id'];
        }

        if (!empty($response['errors'])) {
            return $response;
        }
        $result = $this->company->add($values);
        if ($result) {
            $response['data']['id'] = $values['id'];
        } else {
            $response['errors'][] = 'err01';
        }
        return $response;
    }
1020851
public function bind($name,$params) 
    {

        $this->instances[$name] = $params;
        $this->bind[$name] = true;

    }
51167
public function call($params)
    {
        //Prevent user forgetting connect with the ERP.
        $this->autoConnect();

        $args = array_merge(
            [$this->db, $this->uid, $this->password],
            func_get_args()
        );

        return collect(call_user_func_array([$this->object,'execute_kw'], $args));
    }
957350
public function addRoles(Collection $roles)
    {
        foreach($roles as $role){
            $this->roles->add($role);
        }
        
    }
749721
public function handle($name, array $params = [])
    {
        $model = $params[0];
        $form  = $params[1];
        $form->extend(function(FormGrid $grid) use($model) {
            $grid->fieldset('api_configuration', function (Fieldset $fieldset) use($model) {
                $fieldset->legend(trans('antares/api::labels.api_configuration'));
                $control = $fieldset->control('checkbox', 'enabled')
                        ->label(trans('antares/api::labels.api_enabled'))
                        ->value(1);
                $apiRole = ApiRoles::where(['role_id' => $model->id])->first();

                if (!is_null($apiRole) and $apiRole->enabled) {
                    $control->attributes(['checked' => 'checked']);
                }
            });
        });
    }
400190
public function newRole(Role $request)
    {

        $role = $this->addRole($request->input('title'));

        return redirect()
            ->route('configuration.access.roles.edit', ['id' => $role->id])
            ->with('success', trans('web::seat.role_added'));
    }
267864
public function trigger($event, $params = array()) {
        $eventObject = is_object($event) ? $event : new GenericEvent($event, $params);
        foreach ($this->getListeners($eventObject) as $callback) {
            if (is_array($callback) && count($callback) == 2) {
                list($key, $function) = $callback;
                if (is_string($key) && !class_exists($key) && $this->getServiceManager()->has($key)) {
                    $service = $this->getServiceManager()->get($key);
                    $callback = [$service, $function];
                }
            }
            call_user_func($callback, $eventObject);
        }
    }
654806
protected function _addRoles(array $roles) {
        foreach ($roles as $roleName => $properties) {
            // If the properties aren't set as an array, then we will consider
            // the value as the role ID.
            if (!is_array($properties)) {
                $properties = array('id' => $properties);
            }

            $id = $properties['id'];

            if (is_null($id) || empty($id)) {
                throw new Zend_Application_Resource_Exception(
                    sprintf(
                        $this->_missingPropertyMessage, 'ID', 'role', $roleName
                    )
                );
            }
            $this->_addRoleById($roles, $id);
        }
    }
234296
private function fireEvent($event, ...$params)
    {
        if (!$this->eventManager) {
            return;
        }

        $this->eventManager->handle($event, ...$params);
    }
909073
protected function handleAssetRequest(array $params)
    {
        $response = new Response();

        $assetsConf = $this->config->getSection('asset_resolv');
        $assetsDir  = $this->config->get('app.public_dir') . '/assets';

        if (! empty($assetsConf['current'])) {
            $file = $assetsDir . '/' . $assetsConf['current'] . '/' . $params['filename'];

            if (file_exists($file)) {
                $fileResource = new Http\File\File($file);
                $mtime = filemtime($fileResource->getPathname());

                $response->headers->set('Content-Type', $fileResource->getMimeType());
                $response->setContent(file_get_contents($fileResource->getPathname()));
                $response->setCache(array(
                    'public' => true,
                    'last_modified' => new \DateTime(gmdate("D, d M Y H:i:s", $mtime))
                ));

                $response->setExpires(new \DateTime(gmdate("D, j M Y H:i:s", time() + MONTH)));
                $response->isNotModified($this->request);

                return $response;
            }
        } elseif (! empty($assetsConf['fallback'])) {

        }
    }
10321
public function bind($params = null)
    {

        if (is_array($params)) {
            foreach ($params as $k => $v) {
                $this->bindParam($k, $v);
            }
        }

        return $this;
    }
1069814
public function configureEvent(array $params = []) : void
    {
        $params = array_merge($this->defaultParams, $params);
        foreach ($params as $name => $value) {
            $method = 'set' . ucfirst((string)$name);
            if (method_exists($this, $method) && is_callable([$this, $method])) {
                $this->$method($value);
            }
        }
    }
1176611
public function prepareParms($params)
    {
        if (is_array($params)) {
            foreach ($params as $key => $value) {
                array_push($this->setParams, $value);
            }
        } else {
            array_push($this->setParams, $params);
        }
    }
308759
protected function submitAddRole()
    {
        $this->setSubmitted(null, $this->getParam());
        $this->setSubmittedList('permissions');
        $this->validateComponent('user_role');
        $this->addRole();
    }