Created
September 23, 2012 16:30
-
-
Save tbsmcd/3772219 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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