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