I tried to change a database field everytime a function is called. But it doesn't work. Any ideas or is this complete wrong.
public function changetaskAction($taskitem_id) {
$task = Tasks::find(array(
"taskitem_id = $taskitem_id"
));
if (count($task) == 0) {
$this->flash->error("Task does not exist");
return $this->forward("tasks/index");
}
if ($task->ready="0") {
$ready = "0";
} else {
$ready = "1";
}
$task->ready = $ready;
if ($task->update() == false) {
foreach ($task->getMessages() as $message) {
$this->flash->error($message);
}
} else {
$this->flash->success("Task was updated successfully");
return $this->forward("tasks/index");
}
}