Airship\Cabin\Bridge\Blueprint\UserAccounts::createGroup PHP Method

createGroup() public method

Create a new user group
public createGroup ( array $post = [] ) : boolean
$post array
return boolean
    public function createGroup(array $post = []) : bool
    {
        $this->db->beginTransaction();
        $this->db->insert('airship_groups', ['name' => $post['name'], 'inherits' => $post['parent'] ?? null, 'superuser' => !empty($post['superuser'])]);
        return $this->db->commit();
    }

Usage Example

Example #1
0
 /**
  * Create a new group for users
  *
  * @route crew/groups/new
  */
 public function createGroup()
 {
     $post = $this->post(new NewGroupFilter());
     if (!empty($post)) {
         if ($this->account->createGroup($post)) {
             \Airship\redirect($this->airship_cabin_prefix . '/crew/groups');
         }
     }
     $this->lens('crew/group_new', ['active_link' => 'bridge-link-admin-crew-groups', 'groups' => $this->account->getGroupTree()]);
 }