public function index()
 {
     switch (Input::get('filter')) {
         case 'all':
             $conferences = EloquentConference::all();
             break;
         case 'future':
             $conferences = EloquentConference::future()->get();
             break;
         case 'open_cfp':
             $conferences = EloquentConference::openCfp()->get();
             break;
         case 'unclosed_cfp':
             // Pass through
         // Pass through
         default:
             $conferences = EloquentConference::unclosedCfp()->get();
             break;
     }
     $sort = 'closing_next';
     $sortDir = 'asc';
     if (Input::has('sort')) {
         $sort = Input::get('sort');
         if (substr($sort, 0, 1) == '-') {
             $sort = substr($sort, 1);
             $sortDir = 'desc';
         }
     }
     switch ($sort) {
         case 'alpha':
             $conferences->sortBy(function (EloquentConference $model) {
                 return strtolower($model->title);
             });
             break;
         case 'date':
             $conferences->sortBy(function (EloquentConference $model) {
                 return $model->starts_at;
             });
             break;
         case 'closing_next':
             // Pass through
         // Pass through
         default:
             // Forces closed CFPs to the end. I feel dirty. Even dirtier with the 500 thing.
             $conferences->sortBy(function (EloquentConference $model) {
                 if ($model->cfp_ends_at > Carbon::now()) {
                     return $model->cfp_ends_at;
                 } elseif ($model->cfp_ends_at === null) {
                     return Carbon::now()->addYear(500);
                 } else {
                     return $model->cfp_ends_at->addYear(1000);
                 }
             });
             break;
     }
     if ($sortDir == 'desc') {
         $conferences->reverse();
     }
     return response()->jsonApi(['data' => $conferences->values()]);
 }
 /**
  * Get a list of every event in Joind.in that doesn't exist in our system
  *
  * @return array
  */
 protected function listUnsyncedEvents()
 {
     $return = [];
     $conferences = $this->client->getEvents();
     $alreadyConferences = \Conference::all();
     $joindinIds = $alreadyConferences->map(function ($conference) {
         return (int) $conference->joindin_id;
     });
     $joindinIdsArray = $joindinIds->toArray();
     // @todo this should be a lot simpler if we can get the Collection working
     foreach ($conferences as $conference) {
         if (!in_array($conference['id'], $joindinIdsArray)) {
             $return[] = $conference;
         }
     }
     return $return;
 }