/** * [checkCondition description] * @param [type] $cond [description] * @return [type] [description] */ public function checkCondition($cond) { $rs = Condition::where('cond_name', '=', $cond)->count(); if (isset($rs)) { return $rs >= 1 ? false : true; } }
/** * [delAction description] * @param [type] $id [description] * @return [type] [description] */ public function delAction($id) { Condition::where('id', '=', $id)->delete(); return Redirect::to('condition')->with('success', 'ชื่อเงื่อนไขรหัส = ' . $id . ' ลบทิ้งสำเร้จ'); }
/** * @param string $collection * @param array $condition * @param string $select * @return array */ private function _run_sub_query($collection, $condition, $select = '_id') { if ($this->get_connexion()) { $SubCond = new Condition(); if (is_array($condition)) { $SubCond->set_mongoized($condition); } else { $SubCond->where($condition); } $Query = new Crud\Findr(); $Query->set_connexion($this->get_connexion()); $Query->set_collection($collection); $Query->set_condition($SubCond); $Query->disable_callback(); $Query->select($select); return $Query->all(); } else { //TODO: Exeption cannot execute subqueries without a Rocketr Connexion } }
public function addTerm2() { $con = Condition::where('number', '=', Input::get('number'))->first(); if ($con) { if ($con->id != Input::get('id')) { return Redirect::to('admin/addTerm')->withInput()->withErrors(['warning' => 'Number exist in Terms and Conditions, please update or delete the other to proceed.']); } } $con = new Condition(); $con->number = Input::get('number'); $con->title = Input::get('title'); $con->description = Input::get('desc'); $con->save(); return Redirect::action('AdminController@termsncon'); }