public function postMessageCreate() { $existing = Translation::where('message', '=', Input::get('message'))->where('language_id', '=', Input::get('language'))->get(); if (!$existing->isEmpty()) { Input::flash(); return Redirect::action('Ideaterminal\\Transdb\\Controllers\\TransdbController@getMessageCreate'); } $validator = Validator::make(Input::all(), array('message' => 'required:alphanum', 'translation' => 'required', 'language' => 'required|exists:transdb_languages,id', 'group' => 'required|exists:transdb_groups,id')); if (!$validator->fails()) { $translation = new Translation(); $translation->message = Input::get('message'); $translation->translation = Input::get('translation'); $translation->group_id = Input::get('group'); $translation->language_id = Input::get('language'); $translation->save(); return Redirect::action('Ideaterminal\\Transdb\\Controllers\\TransdbController@getMessageUpdate', array($translation->id)); } else { Input::flash(); return Redirect::action('Ideaterminal\\Transdb\\Controllers\\TransdbController@getMessageCreate')->withErrors($validator); } }