model = new OrderModel(); $this->storeModel = new StoreModel(); parent::__construct($app); } public function index(Request $request) { $params = $request->param(); $format_params = [ 'store_id' => format_string($params['store_id'] ?? null), 'type' => format_string($params['type'] ?? null) != null ? (int)$params['type']: null, ]; $orders = $this->model->findByPaginate($format_params); View::assign([ 'list' => $orders, 'all_store' =>$this->storeModel->findAllStore(), 'params' => $format_params ]); return view(); } public function edit(Request $request) { $params = $request->param(); if(!isset($params['id'])) return $this->fail(lang('ID not exist')); $order = $this->model->findById($params['id']); View::assign([ 'order' => $order, ]); return view(); } }