src/Defender/Repositories/Eloquent/EloquentPermissionRepository.php
public function create($permissionName, $readableName = null)
    {
        if (! is_null($this->findByName($permissionName))) {
            throw new PermissionExistsException('The permission '.$permissionName.' already exists'); // TODO: add translation support
        }

        // Do we have a display_name set?
        $readableName = is_null($readableName) ? $permissionName : $readableName;

        return $permission = $this->model->create([
            'name'          => $permissionName,
            'readable_name' => $readableName,
        ]);
    }
public function create($permissionName, $readableName = null)
    {
        if (! is_null($this->findByName($permissionName))) {
            throw new PermissionExistsException('The permission '.$permissionName.' already exists'); // TODO: add translation support
        }

        // Do we have a display_name set?
        $readableName = is_null($readableName) ? $permissionName : $readableName;

        return $permission = $this->model->create([
            'name'          => $permissionName,
            'readable_name' => $readableName,
        ]);
    }
public function create ( $ permissionName , $ readableName = null ) { if ( ! is_null ( $ this -> findByName ( $ permissionName ) ) ) { throw new PermissionExistsException ( 'The permission ' . $ permissionName . ' already exists' ) ; // TODO: add translation support } // Do we have a display_name set? $ readableName = is_null ( $ readableName ) ? $ permissionName : $ readableName ; return $ permission = $ this -> model -> create ( [ 'name' => $ permissionName , 'readable_name' => $ readableName , ] ) ; }
Create a new permission using the given name.

@param string $permissionName
@param string $readableName

@throws PermissionExistsException

@return Permission
Create a new permission using the given name .