コード例 #1
0
ファイル: ApplicantController.php プロジェクト: pyjac/BSSB
 public function addProfQuali()
 {
     $client = (object) Input::all();
     $db = ProfQualifications::where('user_id', '=', $client->user_id)->first();
     $appData = ApplicationData::find(Input::all()['user_id']);
     $form_comp_data = FormCompleteData::find(Input::all()['user_id']);
     if (is_null($db)) {
         $db = new ProfQualifications();
         foreach ($client as $key => $value) {
             $db->{$key} = $value;
         }
         $db->save();
         $appData->app_progress = 20 + $appData->app_progress;
         $appData->save();
         $form_comp_data->professionbal_qualification_completed = "1";
         $form_comp_data->save();
         return Response::json(array('warning' => 'Adding new stuff'));
     } else {
         foreach ($client as $key => $value) {
             $db->{$key} = $value;
         }
         $db->save();
         return Response::json(array('Warning' => 'Updating old stuff'));
     }
 }