Exemple #1
0
 public function putSection()
 {
     $cre = ['section_name' => Input::get('section_name')];
     $rules = ['section_name' => 'required'];
     $validator = Validator::make($cre, $rules);
     if ($validator->passes()) {
         $section = Section::find(Input::get('section_id'));
         $cv = Cv::select('id')->where('cv_code', Input::get('cv_code'))->first();
         if ($cv->id == $section->cv_id) {
             $section->section_name = Input::get('section_name');
             $section->save();
             $data["message"] = 'Section name is succefully updated';
             $data["section_name"] = Input::get('section_name');
         } else {
             $data["message"] = 'Error in editing section';
         }
         return json_encode($data);
     } else {
         return 'Please fill all the inputs';
     }
 }