Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
we are now able to delete a post
  • Loading branch information
mogria committed Jun 4, 2012
1 parent f0ee640 commit bde97aa
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Controllers/PostsController.php
Expand Up @@ -32,7 +32,14 @@ public function action_create() {
}
public function action_edit() {
}
public function action_delete() {
public function action_delete($id = null) {
try {
Post::find($id)->delete();
Flash::success('The post was sucessfully deleted');
Router::redirect('posts');
} catch(Exception $ex) {
Router::redirect('posts', 'show', Array($id));
}
}

}

0 comments on commit bde97aa

Please sign in to comment.