链街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.

121 lines
3.9 KiB

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