コード例 #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'));
 }
コード例 #2
0
 public function postStore(Request $request)
 {
     $this->validate($request, isset($this->vocabulary->rules_create) ? $this->vocabulary->rules_create : $this->vocabulary->rules);
     Vocabulary::create($request->only('name'));
     return Redirect::to(action('\\Trexology\\Taxonomy\\Controllers\\TaxonomyController@getIndex'))->with('success', 'Created');
 }