public function getPastEventDetails($id)
 {
     //Returns the past event details for event with id $id
     $ev = Event::where('id', $id)->onlyTrashed()->firstorfail();
     //Checks if the current event has any entries in the video table
     $videos = Video::join('events', 'events.id', '=', 'videos.eventid')->join('users', 'users.id', '=', 'videos.userid')->select('videos.link', 'videos.title', 'users.*')->where('events.id', '=', $id)->get();
     //Checks if the current user is an admin
     $admin = Admin::join('users', 'users.id', '=', 'admins.userid')->select('admins.*')->where(['userid' => Auth::user()->id])->distinct()->get();
     //Checks if the current event has any entries in the comments table
     $comments = Comment::join('events', 'events.id', '=', 'comments.eventid')->join('users', 'users.id', '=', 'comments.userid')->select('comments.*', 'users.name')->where('events.id', '=', $id)->orderBy('created_at', 'desc')->get();
     //Checks if the current user has an entry in the rsvp table for the past event
     $rsvp = Rsvp::where('eventid', $id)->where('userid', Auth::user()->id)->get();
     //checks how many entries in the rsvp table there are for the given event, counts them
     $count = Rsvp::where('eventid', $id)->count();
     //returns event details page for the corresponding ID, with event details ($ev), event videos ($videos)
     return view('pastDetails', ['ev' => $ev, 'comments' => $comments, 'count' => $count, 'videos' => $videos, 'rsvp' => $rsvp, 'admin' => $admin]);
 }
 /**
  * Show a list of all the languages posts formatted for Datatables.
  *
  * @return Datatables JSON
  */
 public function data($albumid = 0)
 {
     $condition = intval($albumid) == 0 ? ">" : "=";
     $videoalbum = Video::join('languages', 'languages.id', '=', 'videos.language_id')->join('video_albums', 'video_albums.id', '=', 'videos.video_album_id')->where('videos.video_album_id', $condition, $albumid)->orderBy('videos.position')->select(array('videos.id', DB::raw($albumid . ' as albumid'), DB::getTablePrefix() . 'videos.name', 'video_albums.name as category', DB::getTablePrefix() . 'videos.album_cover', 'languages.name as language', DB::getTablePrefix() . 'videos.created_at'));
     return Datatables::of($videoalbum)->edit_column('album_cover', '<a href="{{{ URL::to(\'admin/video/\' . $id . \'/\' . $albumid . \'/albumcover\' ) }}}" class="btn btn-warning btn-sm" >@if ($album_cover=="1") <span class="glyphicon glyphicon-ok"></span> @else <span class=\'glyphicon glyphicon-remove\'></span> @endif</a>')->add_column('actions', '<a href="{{{ URL::to(\'admin/video/\' . $id . \'/edit\' ) }}}" class="btn btn-success btn-sm iframe" ><span class="glyphicon glyphicon-pencil"></span>  {{ Lang::get("admin/modal.edit") }}</a>
             <a href="{{{ URL::to(\'admin/video/\' . $id . \'/delete\' ) }}}" class="btn btn-sm btn-danger iframe"><span class="glyphicon glyphicon-trash"></span> {{ Lang::get("admin/modal.delete") }}</a>
             <input type="hidden" name="row" value="{{$id}}" id="row">')->remove_column('id')->remove_column('albumid')->make();
 }