LeftSidebarComponent.php 2.0 KB

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