public function index($id) { if ($this->projectService->checkProjectPermissions($id) === false) { return ['error' => 'Access Forbidden']; } return $this->repository->with('project')->findWhere(['project_id' => $id]); }