初始化

This commit is contained in:
2026-08-08 18:27:38 +08:00
parent efc150c937
commit 060eb79c09
336 changed files with 24613 additions and 15 deletions
+31
View File
@@ -0,0 +1,31 @@
<?php
return [
'name' => env('APP_NAME', 'CloudChip'),
'env' => env('APP_ENV', 'production'),
'debug' => (bool) env('APP_DEBUG', false),
'url' => env('APP_URL', 'http://localhost'),
'asset_url' => env('ASSET_URL'),
'timezone' => 'Asia/Shanghai',
'locale' => 'zh_CN',
'fallback_locale' => 'en',
'faker_locale' => 'zh_CN',
'key' => env('APP_KEY'),
'cipher' => 'AES-256-CBC',
'maintenance' => [
'driver' => 'file',
],
];
+35
View File
@@ -0,0 +1,35 @@
<?php
return [
'defaults' => [
'guard' => 'web',
'passwords' => 'users',
],
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
],
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => App\Models\User::class,
],
],
'passwords' => [
'users' => [
'provider' => 'users',
'table' => 'password_reset_tokens',
'expire' => 60,
'throttle' => 60,
],
],
'password_timeout' => 10800,
];
+36
View File
@@ -0,0 +1,36 @@
<?php
return [
'default' => env('CACHE_DRIVER', 'file'),
'stores' => [
'array' => [
'driver' => 'array',
'serialize' => false,
],
'database' => [
'driver' => 'database',
'table' => 'cache',
'connection' => null,
'lock_connection' => null,
],
'file' => [
'driver' => 'file',
'path' => storage_path('framework/cache/data'),
],
'redis' => [
'driver' => 'redis',
'connection' => 'cache',
'lock_connection' => 'default',
],
],
'prefix' => env('CACHE_PREFIX', 'cloudchip_cache'),
];
+21
View File
@@ -0,0 +1,21 @@
<?php
return [
'paths' => ['api/*', 'sanctum/csrf-cookie'],
'allowed_methods' => ['*'],
'allowed_origins' => [env('APP_URL', 'http://localhost')],
'allowed_origins_patterns' => [],
'allowed_headers' => ['*'],
'exposed_headers' => [],
'max_age' => 0,
'supports_credentials' => true,
];
+81
View File
@@ -0,0 +1,81 @@
<?php
use Illuminate\Support\Str;
return [
'default' => env('DB_CONNECTION', 'mysql'),
'connections' => [
'sqlite' => [
'driver' => 'sqlite',
'url' => env('DB_URL'),
'database' => env('DB_DATABASE', database_path('database.sqlite')),
'prefix' => '',
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
],
'mysql' => [
'driver' => 'mysql',
'url' => env('DB_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => env('DB_CHARSET', 'utf8mb4'),
// 宝塔 MySQL5.7 不支持 utf8mb4_0900_ai_ci,必须用 utf8mb4_unicode_ci
'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'),
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
'pgsql' => [
'driver' => 'pgsql',
'url' => env('DB_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => env('DB_CHARSET', 'utf8'),
'prefix' => '',
'prefix_indexes' => true,
'search_path' => 'public',
'sslmode' => 'prefer',
],
],
'migrations' => 'migrations',
'redis' => [
'client' => env('REDIS_CLIENT', 'phpredis'),
'options' => [
'cluster' => env('REDIS_CLUSTER', 'redis'),
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
],
'default' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD'),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_DB', '0'),
],
'cache' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD'),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_CACHE_DB', '1'),
],
],
];
+39
View File
@@ -0,0 +1,39 @@
<?php
return [
'default' => env('FILESYSTEM_DISK', 'local'),
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
'throw' => false,
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
'throw' => false,
],
's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
'endpoint' => env('AWS_ENDPOINT'),
],
],
'links' => [
public_path('storage') => storage_path('app/public'),
],
];
+61
View File
@@ -0,0 +1,61 @@
<?php
use Monolog\Handler\NullHandler;
use Monolog\Handler\StreamHandler;
use Monolog\Handler\SyslogUdpHandler;
use Monolog\Processor\PsrLogMessageProcessor;
return [
'default' => env('LOG_CHANNEL', 'stack'),
'deprecations' => [
'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'),
'trace' => false,
],
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => ['single'],
'ignore_exceptions' => false,
],
'single' => [
'driver' => 'single',
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'warning'),
'replace_placeholders' => true,
],
'daily' => [
'driver' => 'daily',
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'warning'),
'days' => 14,
'replace_placeholders' => true,
],
'stderr' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'warning'),
'handler' => StreamHandler::class,
'with' => [
'stream' => 'php://stderr',
],
'processors' => [PsrLogMessageProcessor::class],
],
'null' => [
'driver' => 'monolog',
'handler' => NullHandler::class,
],
'emergency' => [
'path' => storage_path('logs/laravel.log'),
],
],
];
+62
View File
@@ -0,0 +1,62 @@
<?php
return [
'default' => env('MAIL_MAILER', 'log'),
'mailers' => [
'smtp' => [
'transport' => 'smtp',
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
'port' => env('MAIL_PORT', 587),
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'timeout' => null,
'local_domain' => env('MAIL_EHLO_DOMAIN'),
],
'ses' => [
'transport' => 'ses',
],
'mailgun' => [
'transport' => 'mailgun',
],
'postmark' => [
'transport' => 'postmark',
],
'sendmail' => [
'transport' => 'sendmail',
'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'),
],
'log' => [
'transport' => 'log',
'channel' => env('MAIL_LOG_CHANNEL'),
],
'array' => [
'transport' => 'array',
],
'failover' => [
'transport' => 'failover',
'mailers' => ['smtp', 'log'],
],
],
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'hello@cloud-chip.cn'),
'name' => env('MAIL_FROM_NAME', 'CloudChip'),
],
'markdown' => [
'theme' => 'default',
'paths' => [
resource_path('views/vendor/mail'),
],
],
];
+138
View File
@@ -0,0 +1,138 @@
<?php
/**
* RBAC 权限注册表。
*
* - groups:权限分组(用于后台「用户权限」勾选界面分组)。
* - permissions:全部权限点(key => label + group)。
* - roles:角色默认权限。super_admin 用 '*' 表示全部;
* staff 默认空,由管理员在用户维度勾选分配(写入 users.permissions JSON)。
*
* 解析规则见 App\Models\User::canPerm()。
*/
return [
'groups' => [
'dashboard' => '仪表盘',
'content' => '内容管理',
'forum' => '论坛管理',
'appearance'=> '外观管理',
'users' => '用户与权限',
'settings' => '站点设置',
],
'permissions' => [
// 仪表盘
'dashboard.view' => ['label' => '查看仪表盘', 'group' => 'dashboard'],
// 产品
'products.view' => ['label' => '查看产品', 'group' => 'content'],
'products.create' => ['label' => '新建产品', 'group' => 'content'],
'products.update' => ['label' => '编辑产品', 'group' => 'content'],
'products.delete' => ['label' => '删除产品', 'group' => 'content'],
// 分类
'categories.view' => ['label' => '查看分类', 'group' => 'content'],
'categories.create' => ['label' => '新建分类', 'group' => 'content'],
'categories.update' => ['label' => '编辑分类', 'group' => 'content'],
'categories.delete' => ['label' => '删除分类', 'group' => 'content'],
// 文章
'articles.view' => ['label' => '查看文章', 'group' => 'content'],
'articles.create' => ['label' => '新建文章', 'group' => 'content'],
'articles.update' => ['label' => '编辑文章', 'group' => 'content'],
'articles.delete' => ['label' => '删除文章', 'group' => 'content'],
'articles.moderate' => ['label' => '审核用户投稿', 'group' => 'content'],
// 解决方案
'solutions.view' => ['label' => '查看方案', 'group' => 'content'],
'solutions.create' => ['label' => '新建方案', 'group' => 'content'],
'solutions.update' => ['label' => '编辑方案', 'group' => 'content'],
'solutions.delete' => ['label' => '删除方案', 'group' => 'content'],
// 新闻动态
'news.view' => ['label' => '查看新闻', 'group' => 'content'],
'news.create' => ['label' => '新建新闻', 'group' => 'content'],
'news.update' => ['label' => '编辑新闻', 'group' => 'content'],
'news.delete' => ['label' => '删除新闻', 'group' => 'content'],
// 术语库
'glossary.view' => ['label' => '查看术语', 'group' => 'content'],
'glossary.create' => ['label' => '新建术语', 'group' => 'content'],
'glossary.update' => ['label' => '编辑术语', 'group' => 'content'],
'glossary.delete' => ['label' => '删除术语', 'group' => 'content'],
// 论坛
'forum.view' => ['label' => '查看论坛', 'group' => 'forum'],
'forum.create' => ['label' => '新建板块', 'group' => 'forum'],
'forum.update' => ['label' => '编辑板块', 'group' => 'forum'],
'forum.delete' => ['label' => '删除板块', 'group' => 'forum'],
'forum.moderate' => ['label' => '审核帖子/回复', 'group' => 'forum'],
// 留言
'contacts.view' => ['label' => '查看留言', 'group' => 'users'],
'contacts.delete' => ['label' => '删除留言', 'group' => 'users'],
// 外观管理(首页轮播 / 导航菜单)
'appearance.view' => ['label' => '查看外观设置', 'group' => 'appearance'],
'appearance.update' => ['label' => '修改外观设置', 'group' => 'appearance'],
// 用户与权限
'users.view' => ['label' => '查看用户', 'group' => 'users'],
'users.create' => ['label' => '新增用户', 'group' => 'users'],
'users.update' => ['label' => '编辑用户', 'group' => 'users'],
'users.delete' => ['label' => '删除用户', 'group' => 'users'],
'users.assign_role' => ['label' => '分配角色/权限', 'group' => 'users'],
'users.reset_password' => ['label' => '重置用户密码', 'group' => 'users'],
// 站点设置
'settings.view' => ['label' => '查看站点设置', 'group' => 'settings'],
'settings.update' => ['label' => '修改站点设置', 'group' => 'settings'],
],
'roles' => [
'super_admin' => [
'label' => '超级管理员',
'level' => 5,
'permissions' => ['*'],
],
'admin' => [
'label' => '管理员',
'level' => 4,
'permissions' => [
'dashboard.view',
'products.view', 'products.create', 'products.update', 'products.delete',
'categories.view', 'categories.create', 'categories.update', 'categories.delete',
'articles.view', 'articles.create', 'articles.update', 'articles.delete', 'articles.moderate',
'solutions.view', 'solutions.create', 'solutions.update', 'solutions.delete',
'news.view', 'news.create', 'news.update', 'news.delete',
'glossary.view', 'glossary.create', 'glossary.update', 'glossary.delete',
'forum.view', 'forum.create', 'forum.update', 'forum.delete', 'forum.moderate',
'contacts.view', 'contacts.delete',
'appearance.view', 'appearance.update',
'users.view', 'users.create', 'users.update', 'users.delete', 'users.assign_role', 'users.reset_password',
'settings.view', 'settings.update',
],
],
'forum_admin' => [
'label' => '论坛管理员',
'level' => 3,
'permissions' => [
'dashboard.view',
'forum.view', 'forum.create', 'forum.update', 'forum.delete', 'forum.moderate',
'articles.view', 'articles.moderate',
'contacts.view',
],
],
'staff' => [
'label' => '内部员工',
'level' => 2,
'permissions' => [], // 由管理员在「用户权限」中勾选分配
],
'user' => [
'label' => '注册用户',
'level' => 1,
'permissions' => [],
],
],
];
+46
View File
@@ -0,0 +1,46 @@
<?php
/**
* HTMLPurifier 配置(mews/purifier ^3.4)。
*
* 文章正文为富文本(Quill 产出的 HTML),保存前统一经 Purifier 净化,
* 剥离 script/style/on* 等危险内容,仅保留排版与图片所需标签/属性。
*
* 使用:Purifier::clean($html, 'article')。'default' 作为兜底档。
* Cache.DefinitionImpl 置 null:关闭定义缓存,省去可写缓存目录,部署更省心。
*/
return [
'settings' => [
'default' => [
'HTML.Doctype' => 'HTML 4.01 Transitional',
'HTML.Allowed' => 'div,b,strong,i,em,u,a[href|title|target|rel],ul,ol,li,p,br,span,img[src|alt|width|height|class],blockquote,pre,code,table,thead,tbody,tr,th,td,h1,h2,h3,h4,h5,h6,hr,small,sub,sup',
'CSS.AllowedProperties' => 'text-align,float,margin,width,height,max-width,color,background-color,font-size,font-weight,font-style',
'AutoFormat.AutoParagraph' => false,
'AutoFormat.RemoveEmpty' => true,
'Attr.AllowedFrameTargets' => ['_blank'],
'Attr.AllowedRel' => ['nofollow', 'noopener', 'noreferrer'],
'HTML.TargetBlank' => true,
'URI.AllowedSchemes' => ['http', 'https', 'mailto', 'tel', 'data'],
'URI.MakeAbsolute' => false,
'Cache.DefinitionImpl' => null,
],
'article' => [
'HTML.Doctype' => 'HTML 4.01 Transitional',
// 后台富文本(Quill)会产出 classql-align-*/ql-size-*/ql-indent-* 等,
// 同时首页 Hero 默认内容也用 class 排版;故对常用块级/行内标签放开 class,
// 仅保留白名单标签与安全的 CSS 属性(style 仍受 CSS.AllowedProperties 约束)。
'HTML.Allowed' => 'div[class|style],b[style],strong[style],i[style],em[style],u[style],a[href|title|target|rel|class|style],ul[class|style],ol[class|style],li[class|style],p[class|style],br,span[class|style],img[src|alt|width|height|class|style],blockquote[class|style],pre[class|style],code[class|style],table[class|style],thead[class|style],tbody[class|style],tr[class|style],th[class|style],td[class|style],h1[class|style],h2[class|style],h3[class|style],h4[class|style],h5[class|style],h6[class|style],hr,small[class|style],sub,sup',
'CSS.AllowedProperties' => 'text-align,float,margin,margin-left,margin-right,padding,padding-left,width,height,max-width,color,background-color,font-size,font-weight,font-style',
'AutoFormat.AutoParagraph' => false,
'AutoFormat.RemoveEmpty' => false,
'Attr.AllowedFrameTargets' => ['_blank'],
'Attr.AllowedRel' => ['nofollow', 'noopener', 'noreferrer'],
'HTML.TargetBlank' => true,
'URI.AllowedSchemes' => ['http', 'https', 'mailto', 'tel', 'data'],
'URI.MakeAbsolute' => false,
'Cache.DefinitionImpl' => null,
],
],
'custom_definition' => [],
];
+40
View File
@@ -0,0 +1,40 @@
<?php
return [
'default' => env('QUEUE_CONNECTION', 'sync'),
'connections' => [
'sync' => [
'driver' => 'sync',
],
'database' => [
'driver' => 'database',
'table' => 'jobs',
'queue' => 'default',
'retry_after' => 90,
'after_commit' => false,
],
'redis' => [
'driver' => 'redis',
'connection' => 'default',
'queue' => env('REDIS_QUEUE', 'default'),
'retry_after' => 90,
'block_for' => null,
'after_commit' => false,
],
],
'batching' => [
'database' => 'mysql',
'table' => 'job_batches',
],
'failed' => [
'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'),
'database' => env('DB_CONNECTION', 'mysql'),
'table' => 'failed_jobs',
],
];
+22
View File
@@ -0,0 +1,22 @@
<?php
return [
'mailgun' => [
'domain' => env('MAILGUN_DOMAIN'),
'secret' => env('MAILGUN_SECRET'),
'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'),
'scheme' => 'https',
],
'postmark' => [
'token' => env('POSTMARK_TOKEN'),
],
'ses' => [
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
],
];
+35
View File
@@ -0,0 +1,35 @@
<?php
return [
'driver' => env('SESSION_DRIVER', 'file'),
'lifetime' => (int) env('SESSION_LIFETIME', 120),
'expire_on_close' => false,
'encrypt' => true,
'files' => storage_path('framework/sessions'),
'connection' => env('SESSION_CONNECTION'),
'table' => 'sessions',
'store' => env('SESSION_STORE'),
'lottery' => [2, 100],
'cookie' => env('SESSION_COOKIE', 'cloudchip_session'),
'path' => '/',
'domain' => env('SESSION_DOMAIN'),
'secure' => env('SESSION_SECURE_COOKIE', true),
'http_only' => true,
'same_site' => 'lax',
];
+14
View File
@@ -0,0 +1,14 @@
<?php
return [
'paths' => [
resource_path('views'),
],
'compiled' => env(
'VIEW_COMPILED_PATH',
realpath(storage_path('framework/views'))
),
];