public static function createRole($name, $isDefault, $permissions = [])
    {

        // Create admin role
        $role = (new static());
        $role->name = $name;
        $role->isDefault = $isDefault;
        $role->slug = str_slug($name);

        if($createdRole = $role->save()) {
            // Assert Permissions
            if($permissions) {
                $permissionObj = new Permission();
                foreach ($permissions as $permission) {
                    $permissionObj->assertPermission($role->groupID, $permission);
                }
            }

            return true;
        }

        return false;
    }
public static function createRole($name, $isDefault, $permissions = [])
    {

        // Create admin role
        $role = (new static());
        $role->name = $name;
        $role->isDefault = $isDefault;
        $role->slug = str_slug($name);

        if($createdRole = $role->save()) {
            // Assert Permissions
            if($permissions) {
                $permissionObj = new Permission();
                foreach ($permissions as $permission) {
                    $permissionObj->assertPermission($role->groupID, $permission);
                }
            }

            return true;
        }

        return false;
    }
public static function createRole ( $ name , $ isDefault , $ permissions = [ ] ) { // Create admin role $ role = ( new static ( ) ) ; $ role -> name = $ name ; $ role -> isDefault = $ isDefault ; $ role -> slug = str_slug ( $ name ) ; if ( $ createdRole = $ role -> save ( ) ) { // Assert Permissions if ( $ permissions ) { $ permissionObj = new Permission ( ) ; foreach ( $ permissions as $ permission ) { $ permissionObj -> assertPermission ( $ role -> groupID , $ permission ) ; } } return true ; } return false ; }
Create an admin role.

@param  string $name
@param  bool   $isDefault
@param  array  $permissions ["app" => "lorem", "key" => ipsum]
@return boolean
Create an admin role .