Skip to content

Commit

Permalink
fix datatime object
Browse files Browse the repository at this point in the history
  • Loading branch information
Recca Tsai committed Jun 6, 2016
1 parent 5a478a9 commit 4dde6dc
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Panels/DatabasePanel.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Recca0120\LaravelTracy\Panels;

use DateTime;
use Exception;
use PDO;

Expand Down Expand Up @@ -133,6 +134,10 @@ public function logQuery($prepare, $bindings = [], $time = 0, $name = null, PDO
public static function prepareBindings($prepare, $bindings = [])
{
array_walk($bindings, function (&$binding) {
if ($binding instanceof DateTime) {
$binding = $binding->format('Y-m-d H:i:s');
}

if (is_string($binding) === true) {
$binding = "'".addslashes($binding)."'";
}
Expand Down

0 comments on commit 4dde6dc

Please sign in to comment.