public function q(Request $request) { $search = $request->input("q"); //todo: parse 'q' in separate class and return an array of parameters. // See: https://developer.github.com/v3/search/#search-repositories $matches = []; //look specifically for field limiter 'in' $match = preg_match('/^(?<q>.*)\\bin:(?<in>.*)/us', $search, $matches[]); if ($match) { //just look for uri if (isset($matches[0]['in'])) { $fields = explode(',', $matches[0]['in']); foreach ($fields as $field) { if ('uri' == $field) { //lookup the uri in elements $element = $this->elementRepository->findBy('uri', $matches[0]['q']); if ($element) { return $this->sendResponse($element->toArray(), "element found"); } //lookup the uri in concepts $concept = $this->conceptRepository->findBy('uri', $matches[0]['q']); if ($concept) { return $this->sendResponse($concept->toArray(), "concept found"); } } else { } } } } }
/** * Remove the specified Concept from storage. * * @param int $id * * @return Response */ public function destroy($id) { $concept = $this->conceptRepository->find($id); if (empty($concept)) { Flash::error('Concept not found'); return redirect(route('concepts.index')); } $this->conceptRepository->delete($id); Flash::success('Concept deleted successfully.'); return redirect(route('concepts.index')); }
/** * Remove the specified Concept from storage. * DELETE /concepts/{id} * * @param int $id * * @return Response */ public function destroy($id) { $this->conceptRepository->apiDeleteOrFail($id); return $this->sendResponse($id, "Concept deleted successfully"); }