Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Kontroler - metoda index:
- public function index(Request $request)
- {
- $status = $request->get('status');
- $position = $request->get('position');
- return $this->projectRepository->getProjects($status, $position);
- }
- Repozytorium metoda getProjects
- public function getProjects($status = false, $position = false)
- {
- if ($status && $position) {
- return $this
- ->findWhere([
- 'status' => $status,
- 'position' => $position
- ]);
- }
- elseif ($status) {
- return $this
- ->findWhere([
- 'status' => $status,
- ]);
- }
- elseif ($position) {
- return $this
- ->findWhere([
- 'position' => $position
- ]);
- }
- else {
- return $this->all();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement