diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 0a39373..9b031d3 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -124,8 +124,9 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au $routes->group('order', static function ($routes) { $routes->get('', 'OrderController::index'); $routes->get('view/(:uuid)', 'OrderController::view/$1'); - $routes->post('batchjob', 'OrderController::batchjob`'); $routes->get('delete/(:uuid)', 'OrderController::delete/$1', ['filter' => 'authFilter:master']); + $routes->get('toggle/(:uuid)/(:hash)', 'OrderController::toggle/$1/$2'); + $routes->post('batchjob', 'OrderController::batchjob`'); }); }); $routes->group('front', ['namespace' => 'App\Controllers\Front'], function ($routes) { diff --git a/app/Language/ko/Order.php b/app/Language/ko/Order.php index d52d590..292e21a 100644 --- a/app/Language/ko/Order.php +++ b/app/Language/ko/Order.php @@ -13,5 +13,5 @@ return [ 'updated_at' => "수정일", 'created_at' => "작성일" ], - "STATUS" => ["use" => "결제", "unuse" => "주문취소", "confirm" => "주문완료",] + "STATUS" => ["use" => "주문신청", "unuse" => "주문취소", "confirm" => "주문완료",] ]; diff --git a/app/Models/BaseModel.php b/app/Models/BaseModel.php index 90f1566..f57d605 100644 --- a/app/Models/BaseModel.php +++ b/app/Models/BaseModel.php @@ -63,7 +63,10 @@ abstract class BaseModel extends Model return $this->primaryKey; } abstract public function getTitleField(): string; - abstract public function getEntity($conditions): BaseEntity; + public function getEntity($conditions): BaseEntity + { + return $this->where($conditions)->first() ?: throw new \Exception(__FUNCTION__ . "에서 {$this->getClassName()}의 해당 데이터가 없습니다.\n" . var_export($conditions, true)); + } final public function getEntitys(array $conditions = array()): array { return $this->where($conditions)->findAll(); diff --git a/app/Models/BoardConfigModel.php b/app/Models/BoardConfigModel.php index 8d37996..56cfc7b 100644 --- a/app/Models/BoardConfigModel.php +++ b/app/Models/BoardConfigModel.php @@ -50,7 +50,7 @@ class BoardConfigModel extends BaseModel } public function getEntity($conditions): BoardConfigEntity { - return $this->where($conditions)->first() ?: throw new \Exception("해당 데이터가 없습니다.\n" . var_export($conditions, true)); + return parent::getEntity($conditions); } protected function changeFormData(string $action, string $field, array $formDatas, $entity) diff --git a/app/Models/CategoryModel.php b/app/Models/CategoryModel.php index f80e2b0..0cf6a93 100644 --- a/app/Models/CategoryModel.php +++ b/app/Models/CategoryModel.php @@ -42,7 +42,7 @@ class CategoryModel extends BaseHierarchyModel public function getEntity($conditions): CategoryEntity { - return $this->where($conditions)->first() ?: throw new \Exception("해당 데이터가 없습니다.\n" . var_export($conditions, true)); + return parent::getEntity($conditions); } public function getOptions(array $conditions = array(), $options = array()): array diff --git a/app/Models/OrderModel.php b/app/Models/OrderModel.php index 3be0822..6da17e2 100644 --- a/app/Models/OrderModel.php +++ b/app/Models/OrderModel.php @@ -62,7 +62,7 @@ class OrderModel extends BaseModel } public function getEntity($conditions): OrderEntity { - return $this->where($conditions)->first() ?: throw new \Exception("해당 데이터가 없습니다.\n" . var_export($conditions, true)); + return parent::getEntity($conditions); } public function create(array $formDatas): OrderEntity { diff --git a/app/Models/ProductModel.php b/app/Models/ProductModel.php index ede4c18..a32a7c8 100644 --- a/app/Models/ProductModel.php +++ b/app/Models/ProductModel.php @@ -84,7 +84,7 @@ class ProductModel extends BaseModel public function getEntity($conditions): ProductEntity { - return $this->where($conditions)->first() ?: throw new \Exception("해당 데이터가 없습니다.\n" . var_export($conditions, true)); + return parent::getEntity($conditions); } public function create(array $formDatas): ProductEntity { diff --git a/app/Models/UserModel.php b/app/Models/UserModel.php index e3de42d..b9cfc12 100644 --- a/app/Models/UserModel.php +++ b/app/Models/UserModel.php @@ -53,7 +53,7 @@ class UserModel extends BaseModel } public function getEntity($conditions): UserEntity { - return $this->where($conditions)->first() ?: throw new \Exception("해당 데이터가 없습니다.\n" . var_export($conditions, true)); + return parent::getEntity($conditions); } protected function changeFormData(string $action, string $field, array $formDatas, $entity) diff --git a/app/Models/UserSNSModel.php b/app/Models/UserSNSModel.php index 9017e3a..df81626 100644 --- a/app/Models/UserSNSModel.php +++ b/app/Models/UserSNSModel.php @@ -49,7 +49,7 @@ class UserSNSModel extends BaseModel } public function getEntity($conditions): UserSNSEntity { - return $this->where($conditions)->first() ?: throw new \Exception("해당 데이터가 없습니다.\n" . var_export($conditions, true)); + return parent::getEntity($conditions); } public function create(array $formDatas): UserSNSEntity diff --git a/app/Views/admin/order/index.php b/app/Views/admin/order/index.php index b2bb00d..8239afb 100644 --- a/app/Views/admin/order/index.php +++ b/app/Views/admin/order/index.php @@ -27,7 +27,7 @@ - getStatus() == DEFAULTS['STATUS'] ? anchor(current_url() . '/delete/' . $entity->getPrimaryKey(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) : "" ?> + getStatus() == DEFAULTS['STATUS'] ? anchor('cart/cancelCart/' . $entity->getPrimaryKey(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) : "" ?> diff --git a/app/Views/front/order/index.php b/app/Views/front/order/index.php index d54523e..d9c12d4 100644 --- a/app/Views/front/order/index.php +++ b/app/Views/front/order/index.php @@ -25,9 +25,7 @@ - getStatus() == DEFAULTS['STATUS']) : ?> - getPrimaryKey(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?> - + getStatus() == DEFAULTS['STATUS'] ? anchor('cart/cancelCart/' . $entity->getPrimaryKey(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) : "" ?>