/** * Store a newly created resource in storage. * * @return Response */ public function postStore(Request $request) { $validation = Validator::make($request->all(), Term::$rules); if ($validation->fails()) { return Redirect::back()->withInput()->withErrors($validation)->with('error', 'There were validation errors.'); } $vocabulary = Vocabulary::findOrFail($request->vocabulary_id); $term = \Taxonomy::createTerm($vocabulary->id, $request->name); return Redirect::to(action('\\Trexology\\Taxonomy\\Controllers\\TermsController@getIndex', ['id' => $vocabulary->id]))->with('success', 'Created'); }
/** * Store a newly created resource in storage. * * @return Response */ public function store() { $validation = Validator::make(Input::all(), Term::$rules); if ($validation->fails()) { return Redirect::back()->withInput()->withErrors($validation)->with('error', 'There were validation errors.'); } $vocabulary = Vocabulary::findOrFail(Input::get('vocabulary_id')); $term = \Taxonomy::createTerm($vocabulary->id, Input::get('name')); return Redirect::route($this->route_prefix . 'taxonomy.edit', $vocabulary->id); }