/** * @before _secure */ public function contest($id = null) { $this->seo(['title' => 'Contest', 'description' => 'campaign contest']); $view = $this->getActionView(); if (RM::type() === 'POST') { $msg = \Contest::updateContests($this); $view->set($msg); } if (RM::type() === 'DELETE') { $contest = \Contest::deleteAll(['_id' => $id]); $view->set('message', 'Contest removed!!'); } $contests = \Contest::all(["org_id = ?" => $this->org->_id]); $view->set('contests', $contests); }