Files
2026-03-03 10:06:12 +08:00

52 lines
917 B
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
namespace plugin\saiadmin\service;
/**
* 权限注解
*/
#[\Attribute(\Attribute::TARGET_METHOD | \Attribute::TARGET_CLASS)]
class Permission
{
/**
* 权限标题/名称
*/
public string $title;
/**
* 权限标识唯一格式如module:controller:action
*/
public ?string $slug = null;
/**
* 构造函数 #[Permission(title:'标题', slug:'标识')]
* @param string|null $title
* @param string|null $slug
*/
public function __construct(
?string $title = null,
?string $slug = null,
)
{
$this->title = $title ?? '';
$this->slug = $slug;
}
/**
* 获取权限标题
*/
public function getTitle(): string
{
return $this->title;
}
/**
* 获取权限标识
*/
public function getSlug(): ?string
{
return $this->slug;
}
}