/**
  * @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();
 }
 /**
  * @param \App\Bindings\AddEditCategoryBindingModel $input
  * @param \App\Models\Categories $category
  * @Authorized
  * @UserRole(0)
  */
 public function edit($id, AddEditCategoryBindingModel $input, Categories $category)
 {
     $file = null;
     if ($_FILES['photo']['name'] != "") {
         $file_name = time() . rand(100, 999);
         $file = FileUpload::postImage($_FILES['photo'], $file_name, __DIR__ . '/../../../public/user_data/categories', false, 300);
     }
     $category->edit($id, $input->title, $input->description, $file);
     $this->redirect->to('/products')->go();
 }