Skip to content

Instantly share code, notes, and snippets.

@jawngee
Created July 15, 2009 09:08
Show Gist options
  • Save jawngee/147599 to your computer and use it in GitHub Desktop.
Save jawngee/147599 to your computer and use it in GitHub Desktop.
<?
class PostController extends Controller
{
public function delete()
{
if ($this->request->input->has('post_id'))
{
$post=Model::Instance("blog.post",$this->request->input->post_id);
if ($post)
{
$post->delete();
return array("post" => $post);
}
throw new NotFoundException("Could not find post $post_id.");
}
else
throw new InvalidParametersException("Missing post_id.");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment