コード例 #1
0
 public function addQueryToDetectionForm($formId, Request $request)
 {
     $query = new Query();
     $query->formId = $formId;
     $query->sectionId = $request['sectionId'];
     $query->questionId = $request['questionId'];
     $query->questionType = $request['questionType'];
     $query->optionGroupId = $request['optionGroupId'];
     $query->order = $request['order'];
     $query->units = $request['units'];
     $query->parentQueryId = $request['parentQueryId'];
     try {
         $query->save();
     } catch (\Exception $e) {
         return response()->json(['error' => ['message' => 'Could not create query' . $e->getMessage(), 'code' => 101]]);
     }
     response()->json(['result' => $query]);
 }
コード例 #2
0
ファイル: homeController.php プロジェクト: Amvab/secondhand
 public function postQuery(Request $request)
 {
     $name = Input::get('name');
     $email = Input::get('email');
     $subject = Input::get('subject');
     $message = Input::get('message');
     $post = new Query();
     $post->name = $name;
     $post->email = $email;
     $post->subject = $subject;
     $post->message = $message;
     $post->sent_date = date('Y-m-d');
     $post->save();
     return redirect::to('/')->with('message', 'Query is successfully submitted');
 }