Caffeinated\Shinobi\Models\Permission::assignRole PHP Method

assignRole() public method

Assigns the given role to the permission.
public assignRole ( integer $roleId = null ) : boolean
$roleId integer
return boolean
    public function assignRole($roleId = null)
    {
        $roles = $this->roles;
        if (!$roles->contains($roleId)) {
            return $this->roles()->attach($roleId);
        }
        return false;
    }