Ejemplo n.º 1
0
 public function saveHistoryAction()
 {
     if ($this->request->isPost() == true) {
         $request = json_decode(file_get_contents("php://input"));
         $history = new History();
         $history->history_string = $request->string;
         $history->create() == false ? $this->response->setStatusCode(403, 'Server Error') : $this->response->setStatusCode(201, 'OK');
     } else {
         $this->response->setStatusCode(403, 'Bad request');
     }
 }
Ejemplo n.º 2
0
 private static function sendMail($curr_uid, $matched_uid, $restaurant_id)
 {
     $user1 = User::find($curr_uid);
     $user2 = User::find($matched_uid);
     //Add to User1's history
     History::create(['uid' => $curr_uid, 'matched_id' => $matched_uid, 'restaurant_id' => $restaurant_id]);
     //Add to User2's history
     History::create(['uid' => $matched_uid, 'matched_id' => $curr_uid, 'restaurant_id' => $restaurant_id]);
     $email_data1 = array('recipient' => $user1->email, 'subject' => 'Congratulations! We found you a match!');
     $view_data1 = ['email' => $user2->email, 'gender' => $user2->gender, 'restaurant' => $restaurant_id];
     Mail::send('emails.match', $view_data1, function ($message) use($email_data1) {
         $message->to($email_data1['recipient'])->subject($email_data1['subject']);
     });
     $email_data2 = array('recipient' => $user2->email, 'subject' => 'Congratulations! We found you a match!');
     $view_data2 = ['email' => $user1->email, 'gender' => $user1->gender, 'restaurant' => $restaurant_id];
     Mail::send('emails.match', $view_data2, function ($message) use($email_data2) {
         $message->to($email_data2['recipient'])->subject($email_data2['subject']);
     });
     return true;
 }