/** * @param $id * @param AddEditProductBindingModel $input * @param Products $product * @Authorized * @UserRole(0) */ public function edit($id, AddEditProductBindingModel $input, Products $product) { $file = null; if ($_FILES['photo']['name'] != "") { $file_name = time() . rand(100, 999); $file = FileUpload::postImage($_FILES['photo'], $file_name, __DIR__ . '/../../../public/user_data/products', false, 300); } $product->edit($id, $input->title, $input->description, $input->price, $input->quantity, $input->category, $file); $this->redirect->back()->go(); }