コード例 #1
0
 /**
  * Delete a row from the rsvp table corresponding to the event id and the user id.
  *
  * @param int $id
  * @return \Illuminate\Http\Response
  */
 public function unattendEvent($id)
 {
     //deletes the row corresponding to the current user and the eventid $id from
     //the rsvp table
     Rsvp::where(['userid' => Auth::user()->id, 'eventid' => $id])->delete();
     //redirects to the events page.
     return redirect('/events');
 }
コード例 #2
0
 /**
  * Show the page listing all the attendees for an event.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function getAttendees($id)
 {
     $ev = Event::where('id', $id)->withTrashed()->firstorfail();
     $atns = Rsvp::join('users', 'users.id', '=', 'rsvp.userid')->select('*')->where('rsvp.eventid', '=', $id)->get();
     //Gets the number of attendees
     $count = Rsvp::where('eventid', $id)->count();
     return view('admin/attendees', ['atns' => $atns, 'id' => $id, 'count' => $count, 'ev' => $ev]);
 }