RightSidebarComponent.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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 RightSidebarComponent extends Component
  8. {
  9. /**
  10. * Create a new component instance.
  11. *
  12. * @return void
  13. */
  14. public function __construct()
  15. {
  16. //
  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. $sortType = session()->get('member.SortMenu.C2');
  26. $form = (new Modal('/etc/common/user-menu', null, 'pro'))->getData();
  27. $currentBpa = ProUtils::bpaDecoding(request('bpa'));
  28. try {
  29. $menuPage = ProUtils::getMainMenu($sortType)['Page'] ?? [];
  30. } catch (Exception $e) {
  31. $menuPage = [];
  32. }
  33. $bpa = ProUtils::bpaEncoding($menuPage)->pluck('bpa')->toArray();
  34. $menuPage = collect($menuPage)->map(function ($menu, $index) use ($bpa) {
  35. return array_merge($menu, ['bpa' => $bpa[$index]]);
  36. });
  37. // dd($menuPage);
  38. return view('front.dabory.myapp.components.right-sidebar-component', compact('form','currentBpa', 'menuPage'));
  39. }
  40. }