Files
2025-09-14 22:33:32 +08:00

39 lines
770 B
PHP

<?php
namespace App\Annotation;
use Attribute;
use Hyperf\Di\Annotation\AbstractAnnotation;
#[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_METHOD)]
class Permission extends AbstractAnnotation
{
public const string OPERATION_AND = 'and';
public const string OPERATION_OR = 'or';
/**
* @param array|string $code
* @param string $operation
*/
public function __construct(
protected array|string $code,
protected string $operation = self::OPERATION_AND
) {}
/**
* @return array
*/
public function getCode(): array
{
return (array) $this->code;
}
/**
* @return string
*/
public function getOperation(): string
{
return $this->operation;
}
}