MyAppLeftSidebarComponent.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. namespace App\View\Components;
  3. use App\Helpers\ProUtils;
  4. use Illuminate\View\Component;
  5. use Exception;
  6. class MyAppLeftSidebarComponent extends Component
  7. {
  8. public $menuCode;
  9. /**
  10. * Create a new component instance.
  11. *
  12. * @return void
  13. */
  14. public function __construct($menuCode = '')
  15. {
  16. $this->menuCode = $menuCode;
  17. }
  18. /**
  19. * Get the view / contents that represent the component.
  20. *
  21. * @return \Illuminate\Contracts\View\View|\Closure|string
  22. */
  23. public function render()
  24. {
  25. try {
  26. if (empty(session('member'))) {
  27. $menu = ProUtils::getMainMenu();
  28. } else if (session('member') && isset(session('member')['MemberId'])) {
  29. $menu = ProUtils::getMainMenu();
  30. } else {
  31. $menu = ['Page' => []];
  32. }
  33. } catch (Exception $e) {
  34. $menu = [ 'Page' => [] ];
  35. }
  36. // dd($menu);
  37. if (empty($menu['Page'])) {
  38. notify()->info('사용권한은 시스템 관리자에게 문의하시기 바랍니다.', 'Info', 'bottomRight');
  39. }
  40. $menuPages = [];
  41. if (isset($menu['Page']) && is_array($menu['Page'])) $menuPages = $menu['Page'];
  42. $menuPages = ProUtils::bpaEncoding($menuPages)->toArray();
  43. $menuList = ProUtils::formatMenuList($menuPages);
  44. $bpa = request('bpa');
  45. $disableLMenu = [];
  46. $enableRMenu = [];
  47. if (isset($bpa)) {
  48. $disableLMenu = ProUtils::bpaDecoding($bpa)['disable_l_menu'];
  49. $enableRMenu = ProUtils::bpaDecoding($bpa)['enable_r_menu'];
  50. }
  51. // dump($disableLMenu);
  52. // dump($enableRMenu);
  53. // dd($menuList);
  54. return view('front.dabory.pro.my-app.components.left-sidebar-component', compact('menuList', 'disableLMenu', 'enableRMenu'));
  55. }
  56. }