链街Dcat后台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

117 lines
3.4 KiB

6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
  1. <?php
  2. namespace App\Admin\Controllers;
  3. use App\admin\Metrics\Community\TotalAmount;
  4. use app\admin\Metrics\Community\TotalCommunity;
  5. use App\admin\Metrics\Community\TotalUser;
  6. use App\Admin\Metrics\Examples;
  7. use App\Http\Controllers\Controller;
  8. use Dcat\Admin\Controllers\Dashboard;
  9. use Dcat\Admin\Layout\Column;
  10. use Dcat\Admin\Layout\Content;
  11. use Dcat\Admin\Layout\Row;
  12. use Dcat\Admin\Admin;
  13. class HomeController extends Controller
  14. {
  15. public function index(Content $content)
  16. {
  17. if (Admin::user()->isRole('lanzu_business')) {
  18. return $this->lanzu_biz($content);
  19. }elseif (Admin::user()->isRole('lanzu_mp')) {
  20. return $this->lanzu_mp($content);
  21. }elseif (Admin::user()->isRole('lanzu_mm')) {
  22. return $this->lanzu_mm($content);
  23. }elseif (Admin::user()->isRole('lanzu_cs')){
  24. return $this->lanzu_cs($content);
  25. }
  26. return $this->default($content);
  27. }
  28. protected function default(Content $content)
  29. {
  30. return $content
  31. ->header('Dashboard')
  32. ->description('Description...')
  33. ->body(function (Row $row) {
  34. $row->column(6, function (Column $column) {
  35. $column->row(Dashboard::title());
  36. $column->row(new Examples\Tickets());
  37. });
  38. $row->column(6, function (Column $column) {
  39. $column->row(function (Row $row) {
  40. $row->column(6, new Examples\NewUsers());
  41. $row->column(6, new Examples\NewDevices());
  42. });
  43. $column->row(new Examples\Sessions());
  44. $column->row(new Examples\ProductOrders());
  45. });
  46. });
  47. }
  48. protected function lanzu_mp(Content $content)
  49. {
  50. return $content->header('控制面板')
  51. ->description('欢迎回到懒族后台')
  52. ->body(function (Row $row) {
  53. $row->column(6, function (Column $column) {
  54. });
  55. $row->column(6, function (Column $column) {
  56. });
  57. });
  58. }
  59. protected function lanzu_mm(Content $content)
  60. {
  61. return $content->header('控制面板')
  62. ->description('欢迎回到懒族后台')
  63. ->body(function (Row $row) {
  64. $row->column(6, function (Column $column) {
  65. });
  66. $row->column(6, function (Column $column) {
  67. });
  68. });
  69. }
  70. protected function lanzu_biz(Content $content)
  71. {
  72. return $content->header('控制面板')
  73. ->description('欢迎回到懒族后台')
  74. ->body(function (Row $row) {
  75. $row->column(4, function (Column $column) {
  76. $column->row(new TotalCommunity());
  77. });
  78. $row->column(4, function (Column $column) {
  79. $column->row(new TotalUser());
  80. });
  81. });
  82. }
  83. protected function lanzu_cs(Content $content)
  84. {
  85. return $content->header('控制面板')
  86. ->description('欢迎回到懒族后台')
  87. ->body(function (Row $row) {
  88. $row->column(4, function (Column $column) {
  89. $column->row(new TotalUser());
  90. });
  91. $row->column(4, function (Column $column) {
  92. $column->row(new TotalAmount());
  93. });
  94. });
  95. }
  96. }