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

114 lines
3.4 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
  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(6, function (Column $column) {
  51. });
  52. $row->column(6, function (Column $column) {
  53. });
  54. });
  55. }
  56. protected function lanzu_mm(Content $content)
  57. {
  58. return $content->header('控制面板')
  59. ->description('欢迎回到懒族后台')
  60. ->body(function (Row $row) {
  61. $row->column(6, function (Column $column) {
  62. });
  63. $row->column(6, function (Column $column) {
  64. });
  65. });
  66. }
  67. protected function lanzu_biz(Content $content)
  68. {
  69. return $content->header('控制面板')
  70. ->description('欢迎回到懒族后台')
  71. ->body(function (Row $row) {
  72. $row->column(4, function (Column $column) {
  73. $column->row(new Examples\Community\TotalCommunity());
  74. });
  75. $row->column(4, function (Column $column) {
  76. $column->row(new Examples\Community\TotalUser());
  77. });
  78. });
  79. }
  80. protected function lanzu_cs(Content $content)
  81. {
  82. return $content->header('控制面板')
  83. ->description('欢迎回到懒族后台')
  84. ->body(function (Row $row) {
  85. $row->column(4, function (Column $column) {
  86. $column->row(new Examples\Community\TotalUser());
  87. });
  88. $row->column(4, function (Column $column) {
  89. $column->row(new Examples\Community\TotalAmount());
  90. });
  91. });
  92. }
  93. }