Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. Kontroler - metoda index:
  2.  
  3. public function index(Request $request)
  4. {
  5. $status = $request->get('status');
  6. $position = $request->get('position');
  7.  
  8. return $this->projectRepository->getProjects($status, $position);
  9. }
  10.  
  11.  
  12. Repozytorium metoda getProjects
  13. public function getProjects($status = false, $position = false)
  14. {
  15. if ($status && $position) {
  16. return $this
  17. ->findWhere([
  18. 'status' => $status,
  19. 'position' => $position
  20. ]);
  21. }
  22. elseif ($status) {
  23. return $this
  24. ->findWhere([
  25. 'status' => $status,
  26. ]);
  27. }
  28. elseif ($position) {
  29. return $this
  30. ->findWhere([
  31. 'position' => $position
  32. ]);
  33. }
  34. else {
  35. return $this->all();
  36. }
  37.  
  38.  
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement