Airship\Cabin\Bridge\Blueprint\Permissions::saveAction PHP Méthode

saveAction() public méthode

Update the label for a given action.
public saveAction ( string $cabin, integer $actionId, array $post = [] ) : boolean
$cabin string
$actionId integer
$post array
Résultat boolean
    public function saveAction(string $cabin, int $actionId, array $post = []) : bool
    {
        $this->db->beginTransaction();
        if (!empty($post['label'])) {
            $this->db->update('airship_perm_actions', ['label' => $post['label']], ['actionid' => $actionId, 'cabin' => $cabin]);
        }
        return $this->db->commit();
    }

Usage Example

Exemple #1
0
 /**
  * @route crew/permissions/{string}/action/{id}
  *
  * @param string $cabin
  * @param string $actionId
  */
 public function editAction(string $cabin, string $actionId)
 {
     $actionId = (int) $actionId;
     if (!\in_array($cabin, $this->getCabinNamespaces())) {
         \Airship\redirect($this->airship_cabin_prefix . '/crew/permissions');
     }
     $post = $this->post(new SaveActionFilter());
     $action = $this->perms->getAction($cabin, $actionId);
     if (empty($action)) {
         \Airship\redirect($this->airship_cabin_prefix . '/crew/permissions/' . $cabin);
     }
     if (!empty($post)) {
         if ($this->perms->saveAction($cabin, $actionId, $post)) {
             \Airship\redirect($this->airship_cabin_prefix . '/crew/permissions/' . $cabin);
         }
     }
     $this->lens('perms/action', ['action' => $action]);
 }