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

92 lines
2.6 KiB

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. //dd(Admin::user()->roles);
  15. if(Admin::user()->isRole('lanzu_business')){
  16. return $this->lanzu_biz($content);
  17. }
  18. if(Admin::user()->isRole('lanzu_mp')){
  19. return $this->lanzu_mp($content);
  20. }
  21. if(Admin::user()->isRole('lanzu_mm')){
  22. return $this->lanzu_mm($content);
  23. }
  24. return $this->default($content);
  25. }
  26. protected function default(Content $content){
  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. return $content->header('控制面板')
  47. ->description('欢迎回到懒族后台')
  48. ->body(function (Row $row) {
  49. $row->column(6, function (Column $column) {
  50. });
  51. $row->column(6, function (Column $column) {
  52. });
  53. });
  54. }
  55. protected function lanzu_mm(Content $content){
  56. return $content->header('控制面板')
  57. ->description('欢迎回到懒族后台')
  58. ->body(function (Row $row) {
  59. $row->column(6, function (Column $column) {
  60. });
  61. $row->column(6, function (Column $column) {
  62. });
  63. });
  64. }
  65. protected function lanzu_biz(Content $content)
  66. {
  67. return $content->header('控制面板')
  68. ->description('欢迎回到懒族后台')
  69. ->body(function (Row $row) {
  70. $row->column(6, function (Column $column) {
  71. });
  72. $row->column(6, function (Column $column) {
  73. });
  74. });
  75. }
  76. }