concrete/src/Permission/Key/Key.php
public static function add($pkCategoryHandle, $pkHandle, $pkName, $pkDescription, $pkCanTriggerWorkflow, $pkHasCustomClass, $pkg = false)
    {
        $app = Application::getFacadeApplication();
        $db = $app->make(Connection::class);

        $pkCategoryID = $db->fetchColumn('select pkCategoryID from PermissionKeyCategories where pkCategoryHandle = ?', [$pkCategoryHandle]);
        $db->insert('PermissionKeys', [
            'pkHandle' => $pkHandle,
            'pkName' => $pkName,
            'pkDescription' => $pkDescription,
            'pkCategoryID' => $pkCategoryID,
            'pkCanTriggerWorkflow' => $pkCanTriggerWorkflow ? 1 : 0,
            'pkHasCustomClass' => $pkHasCustomClass ? 1 : 0,
            'pkgID' => is_object($pkg) ? $pkg->getPackageID() : 0,
        ]);
        $pkID = $db->lastInsertId();
        $keys = self::loadAll();

        return $keys[$pkID];
    }
public static function add($pkCategoryHandle, $pkHandle, $pkName, $pkDescription, $pkCanTriggerWorkflow, $pkHasCustomClass, $pkg = false)
    {
        $app = Application::getFacadeApplication();
        $db = $app->make(Connection::class);

        $pkCategoryID = $db->fetchColumn('select pkCategoryID from PermissionKeyCategories where pkCategoryHandle = ?', [$pkCategoryHandle]);
        $db->insert('PermissionKeys', [
            'pkHandle' => $pkHandle,
            'pkName' => $pkName,
            'pkDescription' => $pkDescription,
            'pkCategoryID' => $pkCategoryID,
            'pkCanTriggerWorkflow' => $pkCanTriggerWorkflow ? 1 : 0,
            'pkHasCustomClass' => $pkHasCustomClass ? 1 : 0,
            'pkgID' => is_object($pkg) ? $pkg->getPackageID() : 0,
        ]);
        $pkID = $db->lastInsertId();
        $keys = self::loadAll();

        return $keys[$pkID];
    }
public static function add ( $ pkCategoryHandle , $ pkHandle , $ pkName , $ pkDescription , $ pkCanTriggerWorkflow , $ pkHasCustomClass , $ pkg = false ) { $ app = Application :: getFacadeApplication ( ) ; $ db = $ app -> make ( Connection :: class ) ; $ pkCategoryID = $ db -> fetchColumn ( 'select pkCategoryID from PermissionKeyCategories where pkCategoryHandle = ?' , [ $ pkCategoryHandle ] ) ; $ db -> insert ( 'PermissionKeys' , [ 'pkHandle' => $ pkHandle , 'pkName' => $ pkName , 'pkDescription' => $ pkDescription , 'pkCategoryID' => $ pkCategoryID , 'pkCanTriggerWorkflow' => $ pkCanTriggerWorkflow ? 1 : 0 , 'pkHasCustomClass' => $ pkHasCustomClass ? 1 : 0 , 'pkgID' => is_object ( $ pkg ) ? $ pkg -> getPackageID ( ) : 0 , ] ) ; $ pkID = $ db -> lastInsertId ( ) ; $ keys = self :: loadAll ( ) ; return $ keys [ $ pkID ] ; }
Adds an permission key.

@param string $pkCategoryHandle
@param string $pkHandle
@param string $pkName
@param string $pkDescription
@param bool $pkCanTriggerWorkflow
@param bool $pkHasCustomClass
@param \Concrete\Core\Entity\Package|\Concrete\Core\Package\Package|null $pkg
Adds an permission key .