private function fetchRulesFromDB() { $this->rules = []; $dbrules = RuleModel::where('course_id', '=', $this->courseid)->get(); var_dump($dbrules); $this->dirty = false; }
public function getActions() { $arr = []; foreach ($this->assign_actions as $action) { $arr[] = $action; } foreach ($this->filters as $filter) { $arr[] = $filter; } usort($arr, Rule::getOrderCmp()); return $arr; }
public function exists() { if (isset($this->dbid)) { return true; } $m = RuleModel::where('name', $this->name)->first(); if (!isset($m)) { return false; } if (!$this->actionsMatch($m)) { return false; } $op = $m->operator; // this property is dynamic $o = isset($op); $c = isset($this->condition); if (!$o && !$c) { $this->dbid = $m->id; $this->model = $m; return true; } else { if ($o xor $c) { return false; } } if ($this->condition->matches($op)) { $this->dbid = $m->id; $this->model = $m; return true; } return false; }