Skip to content

Instantly share code, notes, and snippets.

@cgsmith
Created January 17, 2014 03:13
Show Gist options
  • Save cgsmith/8467799 to your computer and use it in GitHub Desktop.
Save cgsmith/8467799 to your computer and use it in GitHub Desktop.
<?php
// This is what the delete method looks like now
function delete($id) {
$bean = R::load($this->className,$id);
R::trash($bean);
$this->render($this->className.'/all','deleted');
}
// This is what the delete method SHOULD look like for logging
use Monolog\Logger;
use Monolog\Handler\StreamHandler; // <-- these would be at the top of the controller
function delete($id) {
$bean = R::load($this->className,$id);
$log = new Logger('mylog');
$log->pushHandler(new StreamHandler('pos.log', Logger::WARNING));
$log->addInfo('Deleting ID#' .$id. ' in ' .$this->className. ' by User');
R::trash($bean);
$this->render($this->className.'/all','deleted');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment