🔧 Changing configuration files.

This commit is contained in:
Wisp X 2022-02-14 11:36:19 +08:00
parent 39238a61d7
commit 11857bbe9d
13 changed files with 159 additions and 246 deletions

View File

@ -32,8 +32,8 @@ final class ConfigKey
const IsUserNeedVerify = 'is_user_need_verify';
/** @var string 邮件配置 */
const MailConfigs = 'mail_configs';
const Mail = 'mail';
/** @var string 角色组默认配置 */
const GroupConfigs = 'group_configs';
const Group = 'group';
}

View File

@ -46,7 +46,7 @@ class GroupController extends Controller
$group = new Group([
'id' => 0,
'name' => '系统默认组',
'configs' => Utils::config(ConfigKey::GroupConfigs),
'configs' => Utils::config(ConfigKey::Group),
]);
} else {
$group = Group::query()->findOrFail($request->route('id'));
@ -66,7 +66,7 @@ class GroupController extends Controller
{
if ($request->route('id') == 0) {
$configs = Utils::parseConfigs(Group::getDefaultConfigs()->toArray(), $request->validated('configs'));
if (! Config::query()->where('name', ConfigKey::GroupConfigs)->update([
if (! Config::query()->where('name', ConfigKey::Group)->update([
'value' => collect($configs)->toJson(),
])) {
return $this->error('保存失败');

View File

@ -22,7 +22,7 @@ class UserController extends Controller
$user = Auth::user();
// 组配置
$configs = Utils::config(ConfigKey::GroupConfigs);
$configs = Utils::config(ConfigKey::Group);
if ($user->group) {
$configs = $user->group->configs;
}

View File

@ -74,7 +74,7 @@ class Group extends Model
*/
public static function getDefaultConfigs(): Collection
{
return collect(config('convention.app.'.ConfigKey::GroupConfigs));
return collect(config('convention.app.'.ConfigKey::Group));
}
/**
@ -84,7 +84,7 @@ class Group extends Model
*/
public static function getGuestConfigs(): Collection
{
return Utils::config(ConfigKey::GroupConfigs);
return Utils::config(ConfigKey::Group);
}
public function users(): HasMany

View File

@ -2,8 +2,11 @@
namespace App\Providers;
use App\Enums\ConfigKey;
use App\Models\Group;
use App\Utils;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\View;
use Illuminate\Support\ServiceProvider;
@ -26,6 +29,9 @@ class AppServiceProvider extends ServiceProvider
*/
public function boot()
{
// 覆盖默认配置
Config::set('mail', array_merge(\config('mail'), Utils::config(ConfigKey::Mail)->toArray()));
// 初始化视图中的默认数据
View::composer('*', function (\Illuminate\View\View $view) {
$configs = Auth::check() && Auth::user()->group ? Auth::user()->group->configs : Group::getGuestConfigs();

View File

@ -54,7 +54,7 @@ class ImageService
$image = new Image();
// 组配置
$configs = Utils::config(ConfigKey::GroupConfigs);
$configs = Utils::config(ConfigKey::Group);
// 默认使用本地储存策略
$disk = collect([
'driver' => StrategyKey::Local,

View File

@ -53,8 +53,8 @@ class Utils
case ConfigKey::IsUserNeedVerify:
$value = (bool) $value;
break;
case ConfigKey::MailConfigs:
case ConfigKey::GroupConfigs:
case ConfigKey::Mail:
case ConfigKey::Group:
$value = collect(json_decode($value, true));
break;
case ConfigKey::UserInitialCapacity:

64
composer.lock generated
View File

@ -893,12 +893,12 @@
}
},
"autoload": {
"psr-4": {
"GuzzleHttp\\": "src/"
},
"files": [
"src/functions_include.php"
]
],
"psr-4": {
"GuzzleHttp\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@ -1733,16 +1733,16 @@
},
{
"name": "league/commonmark",
"version": "2.2.1",
"version": "2.2.2",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/commonmark.git",
"reference": "f8afb78f087777b040e0ab8a6b6ca93f6fc3f18a"
"reference": "13d7751377732637814f0cda0e3f6d3243f9f769"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/commonmark/zipball/f8afb78f087777b040e0ab8a6b6ca93f6fc3f18a",
"reference": "f8afb78f087777b040e0ab8a6b6ca93f6fc3f18a",
"url": "https://api.github.com/repos/thephpleague/commonmark/zipball/13d7751377732637814f0cda0e3f6d3243f9f769",
"reference": "13d7751377732637814f0cda0e3f6d3243f9f769",
"shasum": "",
"mirrors": [
{
@ -1839,7 +1839,7 @@
"type": "tidelift"
}
],
"time": "2022-01-25T14:37:33+00:00"
"time": "2022-02-13T15:00:57+00:00"
},
{
"name": "league/config",
@ -1931,16 +1931,16 @@
},
{
"name": "league/flysystem",
"version": "3.0.4",
"version": "3.0.5",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/flysystem.git",
"reference": "aef771741948595bfbed8e0342dd340695a368ff"
"reference": "0c82591fd8950d499612ada7104c5eba3191e200"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/aef771741948595bfbed8e0342dd340695a368ff",
"reference": "aef771741948595bfbed8e0342dd340695a368ff",
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/0c82591fd8950d499612ada7104c5eba3191e200",
"reference": "0c82591fd8950d499612ada7104c5eba3191e200",
"shasum": "",
"mirrors": [
{
@ -1969,6 +1969,7 @@
"ext-zip": "*",
"friendsofphp/php-cs-fixer": "^3.5",
"google/cloud-storage": "^1.23",
"microsoft/azure-storage-blob": "^1.1",
"phpseclib/phpseclib": "^2.0",
"phpstan/phpstan": "^0.12.26",
"phpunit/phpunit": "^9.5.11",
@ -2006,7 +2007,7 @@
],
"support": {
"issues": "https://github.com/thephpleague/flysystem/issues",
"source": "https://github.com/thephpleague/flysystem/tree/3.0.4"
"source": "https://github.com/thephpleague/flysystem/tree/3.0.5"
},
"funding": [
{
@ -2022,7 +2023,7 @@
"type": "tidelift"
}
],
"time": "2022-02-10T16:14:03+00:00"
"time": "2022-02-12T19:38:15+00:00"
},
{
"name": "league/flysystem-aws-s3-v3",
@ -5503,12 +5504,12 @@
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Mbstring\\": ""
},
"files": [
"bootstrap.php"
]
],
"psr-4": {
"Symfony\\Polyfill\\Mbstring\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@ -7268,7 +7269,7 @@
},
{
"name": "maximebf/debugbar",
"version": "dev-master",
"version": "v1.18.0",
"source": {
"type": "git",
"url": "https://github.com/maximebf/php-debugbar.git",
@ -7300,7 +7301,6 @@
"monolog/monolog": "Log using Monolog",
"predis/predis": "Redis storage"
},
"default-branch": true,
"type": "library",
"extra": {
"branch-alias": {
@ -7335,7 +7335,7 @@
],
"support": {
"issues": "https://github.com/maximebf/php-debugbar/issues",
"source": "https://github.com/maximebf/php-debugbar/tree/master"
"source": "https://github.com/maximebf/php-debugbar/tree/v1.18.0"
},
"time": "2021-12-27T18:49:48+00:00"
},
@ -9605,16 +9605,16 @@
},
{
"name": "spatie/ignition",
"version": "1.0.2",
"version": "1.0.3",
"source": {
"type": "git",
"url": "https://github.com/spatie/ignition.git",
"reference": "d2d5ba823af3004268556e87dfc94449e4159f5a"
"reference": "772a1ba08219afa2d7dae31901f16db414ad7d37"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/spatie/ignition/zipball/d2d5ba823af3004268556e87dfc94449e4159f5a",
"reference": "d2d5ba823af3004268556e87dfc94449e4159f5a",
"url": "https://api.github.com/repos/spatie/ignition/zipball/772a1ba08219afa2d7dae31901f16db414ad7d37",
"reference": "772a1ba08219afa2d7dae31901f16db414ad7d37",
"shasum": "",
"mirrors": [
{
@ -9678,20 +9678,20 @@
"type": "github"
}
],
"time": "2022-01-19T12:57:41+00:00"
"time": "2022-02-13T14:14:39+00:00"
},
{
"name": "spatie/laravel-ignition",
"version": "1.0.4",
"version": "1.0.5",
"source": {
"type": "git",
"url": "https://github.com/spatie/laravel-ignition.git",
"reference": "ca49c7f74022de49910715e8f1ac5ce52123eb3e"
"reference": "c059fafef983db54bf7ebeeb5f9e00006f027fe3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/spatie/laravel-ignition/zipball/ca49c7f74022de49910715e8f1ac5ce52123eb3e",
"reference": "ca49c7f74022de49910715e8f1ac5ce52123eb3e",
"url": "https://api.github.com/repos/spatie/laravel-ignition/zipball/c059fafef983db54bf7ebeeb5f9e00006f027fe3",
"reference": "c059fafef983db54bf7ebeeb5f9e00006f027fe3",
"shasum": "",
"mirrors": [
{
@ -9771,7 +9771,7 @@
"type": "github"
}
],
"time": "2022-02-10T08:50:40+00:00"
"time": "2022-02-13T14:16:05+00:00"
},
{
"name": "symfony/debug",

View File

@ -20,7 +20,7 @@ return [
ConfigKey::IsAllowGuestUpload => 1,
ConfigKey::UserInitialCapacity => 512000,
ConfigKey::IsUserNeedVerify => 1,
ConfigKey::MailConfigs => [
ConfigKey::Mail => [
'default' => 'smtp',
'mailers' => [
'smtp' => [
@ -34,7 +34,7 @@ return [
]
],
],
ConfigKey::GroupConfigs => [
ConfigKey::Group => [
GroupConfigKey::MaximumFileSize => 5120,
GroupConfigKey::ConcurrentUploadNum => 3,
GroupConfigKey::IsEnableScan => 0,

View File

@ -709,12 +709,6 @@ select {
.z-\[1\] {
z-index: 1;
}
.z-\[11\] {
z-index: 11;
}
.z-\[10\] {
z-index: 10;
}
.col-span-6 {
grid-column: span 6 / span 6;
}
@ -748,10 +742,6 @@ select {
margin-top: -0.5rem;
margin-bottom: -0.5rem;
}
.my-5 {
margin-top: 1.25rem;
margin-bottom: 1.25rem;
}
.ml-3 {
margin-left: 0.75rem;
}
@ -779,6 +769,9 @@ select {
.mt-1 {
margin-top: 0.25rem;
}
.mt-5 {
margin-top: 1.25rem;
}
.mb-3 {
margin-bottom: 0.75rem;
}
@ -788,8 +781,8 @@ select {
.mt-6 {
margin-top: 1.5rem;
}
.mt-5 {
margin-top: 1.25rem;
.mb-8 {
margin-bottom: 2rem;
}
.mb-5 {
margin-bottom: 1.25rem;
@ -824,12 +817,6 @@ select {
.-mr-2 {
margin-right: -0.5rem;
}
.mb-6 {
margin-bottom: 1.5rem;
}
.mb-8 {
margin-bottom: 2rem;
}
.block {
display: block;
}
@ -863,12 +850,15 @@ select {
.h-10 {
height: 2.5rem;
}
.h-40 {
height: 10rem;
.h-32 {
height: 8rem;
}
.h-6 {
height: 1.5rem;
}
.h-80 {
height: 20rem;
}
.h-screen {
height: 100vh;
}
@ -893,15 +883,6 @@ select {
.h-4 {
height: 1rem;
}
.h-32 {
height: 8rem;
}
.h-60 {
height: 15rem;
}
.h-80 {
height: 20rem;
}
.min-h-\[150px\] {
min-height: 150px;
}
@ -953,24 +934,9 @@ select {
.w-4 {
width: 1rem;
}
.w-1\/6 {
width: 16.666667%;
}
.w-\[33\.333\%\] {
width: 33.333%;
}
.w-0 {
width: 0px;
}
.min-w-full {
min-width: 100%;
}
.min-w-\[200px\] {
min-width: 200px;
}
.min-w-\[500px\] {
min-width: 500px;
}
.max-w-xl {
max-width: 36rem;
}
@ -983,15 +949,9 @@ select {
.max-w-7xl {
max-width: 80rem;
}
.max-w-md {
max-width: 28rem;
}
.flex-1 {
flex: 1 1 0%;
}
.flex-shrink-0 {
flex-shrink: 0;
}
.shrink-0 {
flex-shrink: 0;
}
@ -1080,12 +1040,6 @@ select {
.grid-cols-1 {
grid-template-columns: repeat(1, minmax(0, 1fr));
}
.grid-cols-4 {
grid-template-columns: repeat(4, minmax(0, 1fr));
}
.grid-cols-2 {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.flex-row {
flex-direction: row;
}
@ -1222,6 +1176,9 @@ select {
.break-words {
overflow-wrap: break-word;
}
.break-all {
word-break: break-all;
}
.rounded-md {
border-radius: 0.375rem;
}
@ -1234,9 +1191,6 @@ select {
.rounded {
border-radius: 0.25rem;
}
.rounded-sm {
border-radius: 0.125rem;
}
.rounded-l-md {
border-top-left-radius: 0.375rem;
border-bottom-left-radius: 0.375rem;
@ -1327,10 +1281,6 @@ select {
--tw-bg-opacity: 1;
background-color: rgb(229 231 235 / var(--tw-bg-opacity));
}
.bg-sky-500 {
--tw-bg-opacity: 1;
background-color: rgb(14 165 233 / var(--tw-bg-opacity));
}
.bg-blue-500 {
--tw-bg-opacity: 1;
background-color: rgb(59 130 246 / var(--tw-bg-opacity));
@ -1339,10 +1289,18 @@ select {
--tw-bg-opacity: 1;
background-color: rgb(107 114 128 / var(--tw-bg-opacity));
}
.bg-sky-500 {
--tw-bg-opacity: 1;
background-color: rgb(14 165 233 / var(--tw-bg-opacity));
}
.bg-black {
--tw-bg-opacity: 1;
background-color: rgb(0 0 0 / var(--tw-bg-opacity));
}
.bg-red-500 {
--tw-bg-opacity: 1;
background-color: rgb(239 68 68 / var(--tw-bg-opacity));
}
.bg-gray-800 {
--tw-bg-opacity: 1;
background-color: rgb(31 41 55 / var(--tw-bg-opacity));
@ -1355,10 +1313,6 @@ select {
--tw-bg-opacity: 1;
background-color: rgb(248 250 252 / var(--tw-bg-opacity));
}
.bg-red-500 {
--tw-bg-opacity: 1;
background-color: rgb(239 68 68 / var(--tw-bg-opacity));
}
.bg-indigo-500 {
--tw-bg-opacity: 1;
background-color: rgb(99 102 241 / var(--tw-bg-opacity));
@ -1409,15 +1363,15 @@ select {
.p-2 {
padding: 0.5rem;
}
.p-3 {
padding: 0.75rem;
}
.p-6 {
padding: 1.5rem;
}
.p-1 {
padding: 0.25rem;
}
.p-3 {
padding: 0.75rem;
}
.px-4 {
padding-left: 1rem;
padding-right: 1rem;
@ -1450,6 +1404,10 @@ select {
padding-top: 0.75rem;
padding-bottom: 0.75rem;
}
.px-3 {
padding-left: 0.75rem;
padding-right: 0.75rem;
}
.px-6 {
padding-left: 1.5rem;
padding-right: 1.5rem;
@ -1458,10 +1416,6 @@ select {
padding-top: 1rem;
padding-bottom: 1rem;
}
.px-3 {
padding-left: 0.75rem;
padding-right: 0.75rem;
}
.px-5 {
padding-left: 1.25rem;
padding-right: 1.25rem;
@ -1478,18 +1432,14 @@ select {
padding-top: 3.5rem;
padding-bottom: 3.5rem;
}
.px-0 {
padding-left: 0px;
padding-right: 0px;
.px-1 {
padding-left: 0.25rem;
padding-right: 0.25rem;
}
.py-0 {
padding-top: 0px;
padding-bottom: 0px;
}
.px-1 {
padding-left: 0.25rem;
padding-right: 0.25rem;
}
.pb-6 {
padding-bottom: 1.5rem;
}
@ -1517,12 +1467,6 @@ select {
.pb-1 {
padding-bottom: 0.25rem;
}
.pl-3 {
padding-left: 0.75rem;
}
.pr-4 {
padding-right: 1rem;
}
.text-left {
text-align: left;
}
@ -1642,18 +1586,58 @@ select {
--tw-text-opacity: 1;
color: rgb(255 255 255 / var(--tw-text-opacity));
}
.text-indigo-600 {
--tw-text-opacity: 1;
color: rgb(79 70 229 / var(--tw-text-opacity));
}
.text-yellow-500 {
--tw-text-opacity: 1;
color: rgb(234 179 8 / var(--tw-text-opacity));
}
.text-indigo-600 {
--tw-text-opacity: 1;
color: rgb(79 70 229 / var(--tw-text-opacity));
}
.text-red-700 {
--tw-text-opacity: 1;
color: rgb(185 28 28 / var(--tw-text-opacity));
}
.text-lime-700 {
--tw-text-opacity: 1;
color: rgb(77 124 15 / var(--tw-text-opacity));
}
.text-lime-600 {
--tw-text-opacity: 1;
color: rgb(101 163 13 / var(--tw-text-opacity));
}
.text-blue-700 {
--tw-text-opacity: 1;
color: rgb(29 78 216 / var(--tw-text-opacity));
}
.text-blue-600 {
--tw-text-opacity: 1;
color: rgb(37 99 235 / var(--tw-text-opacity));
}
.text-cyan-700 {
--tw-text-opacity: 1;
color: rgb(14 116 144 / var(--tw-text-opacity));
}
.text-cyan-600 {
--tw-text-opacity: 1;
color: rgb(8 145 178 / var(--tw-text-opacity));
}
.text-zinc-700 {
--tw-text-opacity: 1;
color: rgb(63 63 70 / var(--tw-text-opacity));
}
.text-zinc-600 {
--tw-text-opacity: 1;
color: rgb(82 82 91 / var(--tw-text-opacity));
}
.text-gray-900 {
--tw-text-opacity: 1;
color: rgb(17 24 39 / var(--tw-text-opacity));
}
.text-orange-500 {
--tw-text-opacity: 1;
color: rgb(249 115 22 / var(--tw-text-opacity));
}
.text-blue-500 {
--tw-text-opacity: 1;
color: rgb(59 130 246 / var(--tw-text-opacity));
@ -1690,58 +1674,6 @@ select {
--tw-text-opacity: 1;
color: rgb(71 85 105 / var(--tw-text-opacity));
}
.text-orange-500 {
--tw-text-opacity: 1;
color: rgb(249 115 22 / var(--tw-text-opacity));
}
.text-red-700 {
--tw-text-opacity: 1;
color: rgb(185 28 28 / var(--tw-text-opacity));
}
.text-blue-700 {
--tw-text-opacity: 1;
color: rgb(29 78 216 / var(--tw-text-opacity));
}
.text-blue-600 {
--tw-text-opacity: 1;
color: rgb(37 99 235 / var(--tw-text-opacity));
}
.text-orange-700 {
--tw-text-opacity: 1;
color: rgb(194 65 12 / var(--tw-text-opacity));
}
.text-orange-600 {
--tw-text-opacity: 1;
color: rgb(234 88 12 / var(--tw-text-opacity));
}
.text-lime-700 {
--tw-text-opacity: 1;
color: rgb(77 124 15 / var(--tw-text-opacity));
}
.text-lime-600 {
--tw-text-opacity: 1;
color: rgb(101 163 13 / var(--tw-text-opacity));
}
.text-cyan-700 {
--tw-text-opacity: 1;
color: rgb(14 116 144 / var(--tw-text-opacity));
}
.text-cyan-600 {
--tw-text-opacity: 1;
color: rgb(8 145 178 / var(--tw-text-opacity));
}
.text-rose-600 {
--tw-text-opacity: 1;
color: rgb(225 29 72 / var(--tw-text-opacity));
}
.text-zinc-700 {
--tw-text-opacity: 1;
color: rgb(63 63 70 / var(--tw-text-opacity));
}
.text-zinc-600 {
--tw-text-opacity: 1;
color: rgb(82 82 91 / var(--tw-text-opacity));
}
.underline {
-webkit-text-decoration-line: underline;
text-decoration-line: underline;
@ -1900,6 +1832,10 @@ select {
--tw-text-opacity: 1;
color: rgb(127 29 29 / var(--tw-text-opacity));
}
.hover\:text-blue-500:hover {
--tw-text-opacity: 1;
color: rgb(59 130 246 / var(--tw-text-opacity));
}
.hover\:text-white:hover {
--tw-text-opacity: 1;
color: rgb(255 255 255 / var(--tw-text-opacity));
@ -1912,14 +1848,6 @@ select {
--tw-text-opacity: 1;
color: rgb(55 65 81 / var(--tw-text-opacity));
}
.hover\:text-indigo-500:hover {
--tw-text-opacity: 1;
color: rgb(99 102 241 / var(--tw-text-opacity));
}
.hover\:text-blue-500:hover {
--tw-text-opacity: 1;
color: rgb(59 130 246 / var(--tw-text-opacity));
}
.focus\:z-10:focus {
z-index: 10;
}
@ -1978,14 +1906,14 @@ select {
--tw-ring-opacity: 1;
--tw-ring-color: rgb(255 255 255 / var(--tw-ring-opacity));
}
.focus\:ring-indigo-500:focus {
--tw-ring-opacity: 1;
--tw-ring-color: rgb(99 102 241 / var(--tw-ring-opacity));
}
.focus\:ring-indigo-200:focus {
--tw-ring-opacity: 1;
--tw-ring-color: rgb(199 210 254 / var(--tw-ring-opacity));
}
.focus\:ring-indigo-500:focus {
--tw-ring-opacity: 1;
--tw-ring-color: rgb(99 102 241 / var(--tw-ring-opacity));
}
.focus\:ring-opacity-50:focus {
--tw-ring-opacity: 0.5;
}
@ -2049,6 +1977,10 @@ select {
margin-bottom: -1px;
}
.sm\:mt-0 {
margin-top: 0px;
}
.sm\:ml-64 {
margin-left: 16rem;
}
@ -2061,10 +1993,6 @@ select {
margin-left: 1.5rem;
}
.sm\:mt-0 {
margin-top: 0px;
}
.sm\:block {
display: block;
}
@ -2164,11 +2092,6 @@ select {
grid-column: span 2 / span 2;
}
.md\:my-10 {
margin-top: 2.5rem;
margin-bottom: 2.5rem;
}
.md\:my-9 {
margin-top: 2.25rem;
margin-bottom: 2.25rem;
@ -2206,10 +2129,6 @@ select {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.md\:grid-cols-4 {
grid-template-columns: repeat(4, minmax(0, 1fr));
}
.md\:flex-row {
flex-direction: row;
}
@ -2263,10 +2182,6 @@ select {
display: none;
}
.lg\:grid-cols-6 {
grid-template-columns: repeat(6, minmax(0, 1fr));
}
.lg\:grid-cols-4 {
grid-template-columns: repeat(4, minmax(0, 1fr));
}
@ -2291,10 +2206,6 @@ select {
grid-template-columns: repeat(4, minmax(0, 1fr));
}
.xl\:grid-cols-8 {
grid-template-columns: repeat(8, minmax(0, 1fr));
}
.xl\:gap-x-8 {
-moz-column-gap: 2rem;
column-gap: 2rem;
@ -2311,10 +2222,6 @@ select {
}
@media (min-width: 1536px) {
.\32xl\:grid-cols-10 {
grid-template-columns: repeat(10, minmax(0, 1fr));
}
.\32xl\:px-60 {
padding-left: 15rem;
padding-right: 15rem;

View File

@ -72,46 +72,46 @@
<p class="mb-3 font-semibold text-lg text-gray-700">邮件配置</p>
<div class="relative p-4 rounded-md bg-white mb-8 space-y-4">
<x-fieldset title="发信驱动">
<x-fieldset-radio id="mail_configs[default]" name="mail_configs[default]" data-select="mailer" value="smtp" checked>SMTP</x-fieldset-radio>
<x-fieldset-radio id="mail[default]" name="mail[default]" data-select="mailer" value="smtp" checked>SMTP</x-fieldset-radio>
</x-fieldset>
<div class="mb-4 hidden" data-mailer-driver="smtp">
<form action="{{ route('admin.settings.save') }}" class="space-y-4">
<div>
<label for="mail_configs[mailers][smtp][host]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>主机地址</label>
<x-input type="text" name="mail_configs[mailers][smtp][host]" id="mail_configs[mailers][smtp][host]" value="{{ $configs['mail_configs']['mailers']['smtp']['host'] }}" placeholder="请输入 SMTP 主机地址"/>
<label for="mail[mailers][smtp][host]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>主机地址</label>
<x-input type="text" name="mail[mailers][smtp][host]" id="mail[mailers][smtp][host]" value="{{ $configs['mail']['mailers']['smtp']['host'] }}" placeholder="请输入 SMTP 主机地址"/>
</div>
<div>
<label for="mail_configs[mailers][smtp][port]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>连接端口</label>
<x-input type="number" name="mail_configs[mailers][smtp][port]" id="mail_configs[mailers][smtp][port]" value="{{ $configs['mail_configs']['mailers']['smtp']['port'] }}" placeholder="请输入 SMTP 主机连接端口"/>
<label for="mail[mailers][smtp][port]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>连接端口</label>
<x-input type="number" name="mail[mailers][smtp][port]" id="mail[mailers][smtp][port]" value="{{ $configs['mail']['mailers']['smtp']['port'] }}" placeholder="请输入 SMTP 主机连接端口"/>
</div>
<div>
<label for="mail_configs[mailers][smtp][username]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>用户名</label>
<x-input type="text" name="mail_configs[mailers][smtp][username]" id="mail_configs[mailers][smtp][username]" value="{{ $configs['mail_configs']['mailers']['smtp']['username'] }}" placeholder="请输入用户名"/>
<label for="mail[mailers][smtp][username]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>用户名</label>
<x-input type="text" name="mail[mailers][smtp][username]" id="mail[mailers][smtp][username]" value="{{ $configs['mail']['mailers']['smtp']['username'] }}" placeholder="请输入用户名"/>
</div>
<div>
<label for="mail_configs[mailers][smtp][password]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>密码</label>
<x-input type="text" name="mail_configs[mailers][smtp][password]" id="mail_configs[mailers][smtp][password]" value="{{ $configs['mail_configs']['mailers']['smtp']['password'] }}" placeholder="请输入密码"/>
<label for="mail[mailers][smtp][password]" class="block text-sm font-medium text-gray-700"><span class="text-red-600">*</span>密码</label>
<x-input type="text" name="mail[mailers][smtp][password]" id="mail[mailers][smtp][password]" value="{{ $configs['mail']['mailers']['smtp']['password'] }}" placeholder="请输入密码"/>
</div>
<div>
<label for="mail_configs[mailers][smtp][encryption]" class="block text-sm font-medium text-gray-700">加密方式</label>
<x-input type="text" name="mail_configs[mailers][smtp][encryption]" id="mail_configs[mailers][smtp][encryption]" value="{{ $configs['mail_configs']['mailers']['smtp']['encryption'] }}" placeholder="请输入加密方式(ssl, tls)"/>
<label for="mail[mailers][smtp][encryption]" class="block text-sm font-medium text-gray-700">加密方式</label>
<x-input type="text" name="mail[mailers][smtp][encryption]" id="mail[mailers][smtp][encryption]" value="{{ $configs['mail']['mailers']['smtp']['encryption'] }}" placeholder="请输入加密方式(ssl, tls)"/>
</div>
<div>
<label for="mail_configs[mailers][smtp][timeout]" class="block text-sm font-medium text-gray-700">连接超时时间()</label>
<x-input type="number" name="mail_configs[mailers][smtp][timeout]" id="mail_configs[mailers][smtp][timeout]" value="{{ $configs['mail_configs']['mailers']['smtp']['timeout'] }}" placeholder="请输入连接超时时间(秒)"/>
<label for="mail[mailers][smtp][timeout]" class="block text-sm font-medium text-gray-700">连接超时时间()</label>
<x-input type="number" name="mail[mailers][smtp][timeout]" id="mail[mailers][smtp][timeout]" value="{{ $configs['mail']['mailers']['smtp']['timeout'] }}" placeholder="请输入连接超时时间(秒)"/>
</div>
<div>
<label for="mail_configs[mailers][smtp][from_address]" class="block text-sm font-medium text-gray-700">发件人地址</label>
<x-input type="email" name="mail_configs[mailers][smtp][from_address]" id="mail_configs[mailers][smtp][from_address]" value="{{ $configs['mail_configs']['mailers']['smtp']['from_address'] ?? '' }}" placeholder="请输入发件人邮箱地址"/>
<label for="mail[mailers][smtp][from_address]" class="block text-sm font-medium text-gray-700">发件人地址</label>
<x-input type="email" name="mail[from][address]" id="mail[from][address]" value="{{ $configs['mail']['from']['address'] ?? '' }}" placeholder="请输入发件人邮箱地址"/>
</div>
<div>
<label for="mail_configs[mailers][smtp][from_name]" class="block text-sm font-medium text-gray-700">发件人名称</label>
<x-input type="text" name="mail_configs[mailers][smtp][from_name]" id="mail_configs[mailers][smtp][from_name]" value="{{ $configs['mail_configs']['mailers']['smtp']['from_name'] ?? '' }}" placeholder="请输入发件人名称"/>
<label for="mail[mailers][smtp][from_name]" class="block text-sm font-medium text-gray-700">发件人名称</label>
<x-input type="text" name="mail[from][name]" id="mail[from][name]" value="{{ $configs['mail']['from']['name'] ?? '' }}" placeholder="请输入发件人名称"/>
</div>
<input type="hidden" name="mail_configs[default]" value="smtp">
<input type="hidden" name="mail_configs[mailers][smtp][transport]" value="smtp">
<input type="hidden" name="mail[default]" value="smtp">
<input type="hidden" name="mail[mailers][smtp][transport]" value="smtp">
<div class="text-right">
<x-button type="submit">保存更改</x-button>

View File

@ -5,7 +5,7 @@ use Illuminate\Support\Facades\Route;
use App\Enums\GroupConfigKey;
use App\Enums\ConfigKey;
$extensions = config('convention.app.'.ConfigKey::GroupConfigs)[GroupConfigKey::AcceptedFileSuffixes];
$extensions = config('convention.app.'.ConfigKey::Group)[GroupConfigKey::AcceptedFileSuffixes];
Route::middleware('cache.headers:public;max_age=2628000;etag')->group(function () use ($extensions) {
Route::any('{key}.{extension}', [
Controller::class, 'output',

View File

@ -22,11 +22,11 @@ class UtilTest extends TestCase
$this->assertTrue(true);
}
if (Utils::config(ConfigKey::MailConfigs) instanceof Collection) {
if (Utils::config(ConfigKey::Mail) instanceof Collection) {
$this->assertTrue(true);
}
if (is_array(Utils::config(ConfigKey::MailConfigs.'.mailers'))) {
if (is_array(Utils::config(ConfigKey::Mail.'.mailers'))) {
$this->assertTrue(true);
}