public function postCreate()
 {
     // validate against the inputs from our form
     $validator = Validator::make(Input::all(), $this->rules);
     if ($validator->fails()) {
         // get the error messages from the validator
         $messages = $validator->messages();
         // redirect our user back to the form with the errors from the validator
         return Redirect::back()->withErrors($messages);
     } else {
         $data = new CompetencyDictionary();
         $data->type_id = Input::get('type_id');
         $data->order_deputi = Input::get('order_deputi');
         $data->code = Input::get('code');
         $data->parent = Input::get('parent');
         $data->title = Input::get('title');
         $data->description = Input::get('description');
         $detail['cakupan'] = Input::get('cakupan');
         $data->detail = json_encode($detail);
         if ($data->save()) {
             return Redirect::to('admin/dictionary/detail');
         } else {
             return Redirect::back();
         }
     }
 }
Пример #2
0
 public function postCreate($id)
 {
     // validate against the inputs from our form
     $validator = Validator::make(Input::all(), $this->rules);
     if ($validator->fails()) {
         // get the error messages from the validator
         $messages = $validator->messages();
         // redirect our user back to the form with the errors from the validator
         return Redirect::back()->withErrors($messages);
     } else {
         $data = new CompetencyDictionary();
         $data->dictionary_id = Input::get('dictionary_id');
         $data->value = Input::get('value');
         $data->title = Input::get('title');
         $data->description = Input::get('description');
         if ($data->save()) {
             return Redirect::to('admin/competency/level/dictionary/' . $id);
         } else {
             return Redirect::back();
         }
     }
     //        dd('under construction');
 }