public function store() { $inputData = Input::only('title', 'description', 'phone', 'category', 'contact_person', 'contact_phone', 'classified_category_id'); $validator = Validator::make($inputData, $this->storeValidationRules); if ($validator->passes()) { $classified = Classified::create($inputData); if (Input::hasFile('photo')) { $this->savePhotos($classified); } return true; } else { return false; } }
public function updateclassifiedAction() { global $mySession; $db = new Db(); $c_id = $this->getRequest()->getParam('c_id'); $this->view->c_id = $c_id; $catData = $db->runQuery("select * from " . Classified . " where c_id='" . $c_id . "'"); $this->view->pageHeading = "Edit Classified"; if ($this->getRequest()->isPost()) { $request = $this->getRequest(); $myform = new Form_Classifiedcategory($c_id); if ($myform->isValid($request->getPost())) { $dataForm = $myform->getValues(); $myObj = new Classified(); $Result = $myObj->Updateclassified($dataForm, $c_id); if ($Result == 1) { $mySession->errorMsg = "Classified updated successfully."; $this->_redirect('classified/classifiedcategory'); } else { $mySession->errorMsg = "Classified name you entered is already exists."; $this->view->myform = $myform; $this->render('editclassified'); } } else { $this->view->myform = $myform; $this->render('editclassified'); } } else { $this->_redirect('classified/editclassified/c_id/' . $c_id); } }