Files
water_new/app/Admin/Controllers/Dashboard.php
2023-03-08 09:16:04 +08:00

184 lines
6.5 KiB
PHP

<?php
namespace App\Admin\Controllers;
use Encore\Admin\Admin;
use Illuminate\Contracts\View\Factory;
use Illuminate\Support\Arr;
use Illuminate\View\View;
use Nwidart\Modules\Facades\Module;
class Dashboard
{
/**
* @return Factory|View
*/
public static function title()
{
return view('admin.dashboard.title');
}
/**
* @return Factory|View
*/
public static function environment()
{
$envs = [
['name' => 'PHP version', 'value' => 'PHP/'.PHP_VERSION],
['name' => 'Laravel version', 'value' => app()->version()],
['name' => 'CGI', 'value' => php_sapi_name()],
['name' => 'Uname', 'value' => php_uname()],
['name' => 'Server', 'value' => Arr::get($_SERVER, 'SERVER_SOFTWARE')],
['name' => 'Cache driver', 'value' => config('cache.default')],
['name' => 'Session driver', 'value' => config('session.driver')],
['name' => 'Queue driver', 'value' => config('queue.default')],
['name' => 'Timezone', 'value' => config('app.timezone')],
['name' => 'Locale', 'value' => config('app.locale')],
['name' => 'Env', 'value' => config('app.env')],
['name' => 'URL', 'value' => config('app.url')],
];
return view('admin.dashboard.environment', compact('envs'));
}
/**
* @return Factory|View
*/
public static function extensions()
{
$extensions = [
'user' => [
'name' => '用户模块',
'link' => 'https://git.yuzhankeji.cn/UzTech/laravel-user-module',
'icon' => 'users',
],
'chain' => [
'name' => '区块链管理',
'link' => 'https://git.yuzhankeji.cn/UzTech/laravel-chain-module',
'icon' => 'chain',
],
'lottery' => [
'name' => '抽奖模块',
'link' => 'https://git.yuzhankeji.cn/UzTech/laravel-lottery-module',
'icon' => 'gavel',
],
'task' => [
'name' => '任务模块',
'link' => 'https://git.yuzhankeji.cn/UzTech/laravel-task-module',
'icon' => 'hourglass-end',
],
'cms' => [
'name' => '内容管理',
'link' => 'https://git.yuzhankeji.cn/UzTech/laravel-cms-module',
'icon' => 'book',
],
'appversion' => [
'name' => 'App版本',
'link' => 'https://git.yuzhankeji.cn/UzTech/laravel-appversion-module',
'icon' => 'apple',
],
'mall' => [
'name' => '多用户商城',
'link' => 'https://git.yuzhankeji.cn/UzTech/laravel-mall-module',
'icon' => 'shopping-cart',
],
'payment' => [
'name' => '支付模块',
'link' => 'https://git.yuzhankeji.cn/UzTech/laravel-payment-module',
'icon' => 'paypal',
],
'company' => [
'name' => '企业管理',
'link' => 'https://git.yuzhankeji.cn/UzTech/laravel-company-module',
'icon' => 'black-tie',
],
'coupon' => [
'name' => '优惠券模块',
'link' => 'https://git.yuzhankeji.cn/UzTech/laravel-coupon-module',
'icon' => 'qrcode',
],
'settlement' => [
'name' => '结算模块',
'link' => 'https://git.yuzhankeji.cn/UzTech/laravel-settlement-module',
'icon' => 'sliders',
],
'configuration' => [
'name' => '参数配置',
'link' => 'https://git.yuzhankeji.cn/UzTech/laravel-configuration-module',
'icon' => 'cogs',
],
'withdraw' => [
'name' => '提现管理',
'link' => 'https://git.yuzhankeji.cn/UzTech/laravel-withdraw-module',
'icon' => 'clock-o',
],
'notification' => [
'name' => '消息中心',
'link' => 'https://git.yuzhankeji.cn/UzTech/laravel-notification-module',
'icon' => 'envelope',
],
'linker' => [
'name' => '链接管理',
'link' => 'https://git.yuzhankeji.cn/UzTech/laravel-linker-module',
'icon' => 'link',
],
'storage' => [
'name' => '文件存储',
'link' => 'https://git.yuzhankeji.cn/UzTech/laravel-storage-module',
'icon' => 'file',
],
'omniform' => [
'name' => '万能表单',
'link' => 'https://git.yuzhankeji.cn/UzTech/laravel-omni-form-module',
'icon' => 'wpforms',
],
'tao' => [
'name' => '淘宝客',
'link' => 'https://git.yuzhankeji.cn/UzTech/laravel-tao-module',
'icon' => 'simplybuilt',
],
'market' => [
'name' => '交易市场',
'link' => 'https://git.yuzhankeji.cn/UzTech/laravel-market-module',
'icon' => 'asl-interpreting',
],
'tokenmall' => [
'name' => '区块链商城',
'link' => 'https://git.yuzhankeji.cn/UzTech/laravel-token-mall-module',
'icon' => 'flask',
],
'acme' => [
'name' => 'SSL免费证书',
'link' => 'https://git.yuzhankeji.cn/UzTech/laravel-acme-module',
'icon' => 'html5',
],
];
foreach ($extensions as $key => &$extension) {
$module = Module::find($key);
if ($module) {
$extension['installed'] = (int) $module->isEnabled();
} else {
$extension['installed'] = 2;
}
}
return view('admin.dashboard.extensions', compact('extensions'));
}
/**
* @return string
*/
public static function dependencies(): string
{
$json = file_get_contents(base_path('composer.json'));
$dependencies = json_decode($json, true)['require'];
return Admin::component('admin.dashboard.dependencies', compact('dependencies'));
}
}