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

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