提交代码
This commit is contained in:
71
app/Admin/Controllers/HomeController.php
Normal file
71
app/Admin/Controllers/HomeController.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace App\Admin\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\User;
|
||||
use Encore\Admin\Layout\Column;
|
||||
use Encore\Admin\Layout\Content;
|
||||
use Encore\Admin\Layout\Row;
|
||||
use Encore\Admin\Widgets\InfoBox;
|
||||
use RuLong\Order\Models\Order;
|
||||
|
||||
class HomeController extends Controller
|
||||
{
|
||||
public function index(Content $content)
|
||||
{
|
||||
return $content
|
||||
->title('控制台')
|
||||
->description('数据中心')
|
||||
->row(function (Row $row) {
|
||||
$row->column(2, function (Column $column) {
|
||||
$column->append(new InfoBox('总用户数', 'user', 'yellow', '/admin/users', User::count()));
|
||||
});
|
||||
$row->column(2, function (Column $column) {
|
||||
$column->append(new InfoBox('会员', 'users', 'yellow', '/admin/users?identity[identity_id]=1', User::whereHas('identity', function ($q) {$q->where('identity_id', 1);})->count()));
|
||||
});
|
||||
|
||||
$row->column(2, function (Column $column) {
|
||||
$column->append(new InfoBox('金牌', 'users', 'yellow', '/admin/users?identity[identity_id]=2', User::whereHas('identity', function ($q) {$q->where('identity_id', 2);})->count()));
|
||||
});
|
||||
$row->column(2, function (Column $column) {
|
||||
$column->append(new InfoBox('城市', 'users', 'yellow', '/admin/users?identity[identity_id]=3', User::whereHas('identity', function ($q) {$q->where('identity_id', 3);})->count()));
|
||||
});
|
||||
$row->column(2, function (Column $column) {
|
||||
$column->append(new InfoBox('股东', 'users', 'yellow', '/admin/users?identity[identity_id]=4', User::whereHas('identity', function ($q) {$q->where('identity_id', 4);})->count()));
|
||||
});
|
||||
})
|
||||
->row(function (Row $row) {
|
||||
$row->column(3, function (Column $column) {
|
||||
$column->append(new InfoBox('总订单数', 'print', 'orange', 'admin/orders', Order::count()));
|
||||
});
|
||||
$row->column(3, function (Column $column) {
|
||||
$column->append(new InfoBox('已支付', 'dollar', 'orange', 'admin/orders?state=PAID', Order::UnDeliver()->count()));
|
||||
});
|
||||
$row->column(3, function (Column $column) {
|
||||
$column->append(new InfoBox('已发货', 'dollar', 'orange', 'admin/orders?state=DELIVERED', Order::Delivered()->count()));
|
||||
});
|
||||
$row->column(3, function (Column $column) {
|
||||
$column->append(new InfoBox('已签收', 'dollar', 'orange', 'admin/orders?state=SIGNED', Order::Signed()->count()));
|
||||
});
|
||||
});
|
||||
// return $content
|
||||
// ->title('Dashboard')
|
||||
// ->description('Description...')
|
||||
// ->row(Dashboard::title())
|
||||
// ->row(function (Row $row) {
|
||||
|
||||
// $row->column(4, function (Column $column) {
|
||||
// $column->append(Dashboard::environment());
|
||||
// });
|
||||
|
||||
// $row->column(4, function (Column $column) {
|
||||
// $column->append(Dashboard::extensions());
|
||||
// });
|
||||
|
||||
// $row->column(4, function (Column $column) {
|
||||
// $column->append(Dashboard::dependencies());
|
||||
// });
|
||||
// });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user