Skip to content

Instantly share code, notes, and snippets.

@tbsmcd
Created September 23, 2012 16:30
Show Gist options
  • Save tbsmcd/3772219 to your computer and use it in GitHub Desktop.
Save tbsmcd/3772219 to your computer and use it in GitHub Desktop.
<?php
class MessagesController extends AppController {
public function index() {
$messages = $this->Message->find('all');
$this->set(compact('messages'));
}
public function add() {
if ($this->request->is('post')) {
if ($this->Message->save($this->request->data)) {
$this->Session->setFlash('This message has been sent.');
return $this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash('Fail');
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment