first commit

This commit is contained in:
2025-09-12 15:23:08 +08:00
commit a80c237bbb
117 changed files with 15628 additions and 0 deletions

View File

@@ -0,0 +1,78 @@
<?php
namespace App\Model\Meta;
use App\Model\Model;
/**
* @property string $title 标题
* @property string $i18n 国际化
* @property string $badge 徽章
* @property string $icon 图标
* @property bool $affix 是否固定
* @property bool $hidden 是否隐藏
* @property string $type 类型
* @property bool $cache 是否缓存
* @property bool $copyright 是否显示版权
* @property string $link 链接
* @property string $componentPath 视图文件类型
* @property string $componentSuffix 视图前缀路径
* @property string $breadcrumbEnable 是否显示面包屑
* @property string $activeName 激活高亮的菜单标识
* @property string $auth 前端权限判断,允许访问的权限码
* @property string $role 前端权限判断,允许访问的角色码
* @property string $user 前端权限判断,允许访问的用户名
*/
final class AdminUserMeta extends Model
{
/**
* @var bool
*/
public bool $incrementing = false;
/**
* @var array|string[]
*/
protected array $fillable = [
'title',
'i18n',
'badge',
'icon',
'affix',
'hidden',
'type',
'cache',
'copyright',
'breadcrumbEnable',
'componentPath',
'componentSuffix',
'link',
'activeName',
'auth',
'role',
'user',
];
/**
* @var array|string[]
*/
protected array $casts = [
'affix' => 'boolean',
'hidden' => 'boolean',
'cache' => 'boolean',
'copyright' => 'boolean',
'breadcrumbEnable' => 'boolean',
'title' => 'string',
'componentPath' => 'string',
'componentSuffix' => 'string',
'i18n' => 'string',
'badge' => 'string',
'icon' => 'string',
'type' => 'string',
'link' => 'string',
'activeName' => 'string',
'auth' => 'array',
'role' => 'array',
'user' => 'array',
];
}

View File

@@ -0,0 +1,33 @@
<?php
namespace App\Model\Meta;
use Hyperf\Codec\Json;
use Hyperf\Contract\CastsAttributes;
class MetaCast implements CastsAttributes
{
/**
* @param $model
* @param string $key
* @param $value
* @param array $attributes
* @return AdminUserMeta
*/
public function get($model, string $key, $value, array $attributes): AdminUserMeta
{
return new AdminUserMeta(empty($value) ? [] : Json::decode($value));
}
/**
* @param $model
* @param string $key
* @param $value
* @param array $attributes
* @return array|string
*/
public function set($model, string $key, $value, array $attributes): array|string
{
return Json::encode($value);
}
}