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

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