MyAppRightSidebarComponent.php 978 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. namespace App\View\Components;
  3. use App\Helpers\ProUtils;
  4. use Illuminate\View\Component;
  5. class MyAppRightSidebarComponent extends Component
  6. {
  7. /**
  8. * Create a new component instance.
  9. *
  10. * @return void
  11. */
  12. public function __construct()
  13. {
  14. //
  15. }
  16. /**
  17. * Get the view / contents that represent the component.
  18. *
  19. * @return \Illuminate\Contracts\View\View|\Closure|string
  20. */
  21. public function render()
  22. {
  23. $currentBpa = ProUtils::bpaDecoding(request('bpa'));
  24. $menuPage = ProUtils::getMainMenu()['Page'] ?? [];
  25. $bpa = ProUtils::bpaEncoding($menuPage)->pluck('bpa')->toArray();
  26. $menuPage = collect($menuPage)->map(function ($menu, $index) use ($bpa) {
  27. return array_merge($menu, ['bpa' => $bpa[$index]]);
  28. });
  29. // dd($menuPage);
  30. return view('front.dabory.pro.my-app.components.right-sidebar-component', compact('currentBpa', 'menuPage'));
  31. }
  32. }