public function deleteAction($id = false) { $this->permission('delete'); if (!$id) { return Brightery::error404(); } $commerce = new \modules\commerce\models\Commerce_shares(); $commerce->commerce_shares_id = $id; if ($commerce->delete()) { Uri_helper::redirect("management/commerce_shares"); } }
public function indexAction() { $userInfo = $this->permissions->getUserInformation(); if (!$userInfo) { Uri_helper::redirect("users"); } $commerce = new \modules\commerce\models\Commerce_shares('frontend_add'); $commerce->attributes = $this->Input->input['post']; $commerce->user_id = $userInfo->user_id; if ($commerce->save()) { Uri_helper::redirect("commerce_sharing"); } else { return $this->render('commerce_manage_sharing', ['item' => $commerce->get()]); } }