/** * @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(); }