|  | 
 |  | 
 | 
												
													
														| 41 |       */
 | 41 |       */
 | 
												
													
														| 42 |      public function post(Request $request){
 | 42 |      public function post(Request $request){
 | 
												
													
														| 43 |          $lineUserId = $request->lineUserId; //line UID
 | 43 |          $lineUserId = $request->lineUserId; //line UID
 | 
												
													
														| 44 | -        $headSticker = $request->headSticker; //頭貼
 |  | 
 | 
												
													
														|  | 
 | 44 | +        $headSticker = $request->headSticker ?? ""; //頭貼
 | 
												
													
														| 45 |          $healthAction = $request->healthAction; //平常你有什麼健康行動(複選)
 | 45 |          $healthAction = $request->healthAction; //平常你有什麼健康行動(複選)
 | 
												
													
														| 46 |          $healthTopic = $request->healthTopic; //你對什麼健康話題有興趣(複選)
 | 46 |          $healthTopic = $request->healthTopic; //你對什麼健康話題有興趣(複選)
 | 
												
													
														| 47 |          $healthStatus = $request->healthStatus; //你覺得自己的身體狀況如何
 | 47 |          $healthStatus = $request->healthStatus; //你覺得自己的身體狀況如何
 | 
												
											
												
													
														|  | 
 |  | 
 | 
												
													
														| 81 |              $this->botActionsSend($lineUserId,$buildActions);
 | 81 |              $this->botActionsSend($lineUserId,$buildActions);
 | 
												
													
														| 82 |  
 | 82 |  
 | 
												
													
														| 83 |              //儲存填寫資料
 | 83 |              //儲存填寫資料
 | 
												
													
														| 84 | -            $survey_data = new Survey();
 |  | 
 | 
												
													
														|  | 
 | 84 | +            $survey_data = Survey::where('line_user_id',$lineUserId)->first();
 | 
												
													
														|  | 
 | 85 | +            if(empty($survey_data->id)){
 | 
												
													
														|  | 
 | 86 | +                $survey_data = new Survey();
 | 
												
													
														|  | 
 | 87 | +            }
 | 
												
													
														| 85 |              $survey_data->line_user_id = $lineUserId;
 | 88 |              $survey_data->line_user_id = $lineUserId;
 | 
												
													
														| 86 |              $survey_data->head_sticker = $headSticker;
 | 89 |              $survey_data->head_sticker = $headSticker;
 | 
												
													
														| 87 |              $survey_data->nickname = $healthNickname;
 | 90 |              $survey_data->nickname = $healthNickname;
 |