Example #1
0
 public function match($id, Request $request)
 {
     $valentineId = $request->cookie('shy_first_id');
     $this->changeViewStatus($id);
     $Notifications = Notifications::where('valentineId', '=', $valentineId)->get()->toArray();
     foreach ($Notifications as $key => $value) {
         if ($value['id'] === $id) {
         }
         $coolId = $value['coolId'];
     }
     $cool = Valentine::find($coolId)->toArray();
     $data = array('cool' => $cool, 'Notifications' => $Notifications);
     return view('match', $data);
 }
Example #2
0
 public static function notify($despoId, $coolId)
 {
     $despoNotification = new Notifications();
     $coolNotification = new Notifications();
     $despoNotification->valentineId = $despoId;
     $coolNotification->valentineId = $coolId;
     $despo = Valentine::find($despoId);
     $cool = Valentine::find($coolId);
     $despoNotification->coolId = $coolId;
     $coolNotification->coolId = $despoId;
     $despoNotification->name = $cool->name;
     $coolNotification->name = $despo->name;
     $despoNotification->save();
     $coolNotification->save();
     Mail::send('emails.match', ['id' => $cool->id], function ($message) use($despo, $cool) {
         $message->to($despo->email, $despo->name)->subject($cool->name . 'Likes You too');
     });
     Mail::send('emails.match', ['id' => $despo->id], function ($message) use($cool, $despo) {
         $message->to($cool->email, $cool->name)->subject($despo->name . 'Likes You too');
     });
 }