Example #1
0
 public function leave_get($event_id)
 {
     try {
         $event = $this->model->get_by_id($event_id);
         if (!$event) {
             $this->response(sprintf(lang('not_found'), ucfirst(lang('event'))), 404);
         }
         $this->model->leave_event($event_id, $this->user_id);
         $this->send_notification('user_left', $event_id);
         $this->response(true, 200);
     } catch (Exception $e) {
         $this->response($e->getMessage(), $e->getCode());
     }
 }