Example #1
0
 public function getIndex(Request $request)
 {
     $vocabulary = Vocabulary::findOrFail($request->id);
     $parents = DB::select("SELECT id, name, EXISTS (SELECT id FROM terms as children WHERE children.parent = terms.id LIMIT 1) as child\n\t\tfrom terms\n\t\twhere terms.parent = 0 and terms.vocabulary_id = ?\n\t\torder by terms.weight ASC", [$request->id]);
     $terms = $this->getChild($parents);
     return view('taxonomy::terms.index', compact('vocabulary', 'terms'));
 }