Created
March 24, 2015 07:36
-
-
Save ethaizone/d87572831bf8092a6a98 to your computer and use it in GitHub Desktop.
Simple laravel helper - Dump Query
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 | |
// write by me. | |
if ( ! function_exists('dq')) | |
{ | |
function dq($offset = 0, $length = null, $echoOnly = false) | |
{ | |
s(array_slice(DB::getQueryLog(), $offset, $length)); | |
if ($echoOnly == false) | |
{ | |
exit(); | |
} | |
} | |
} | |
if ( ! function_exists('dqw')) | |
{ | |
function dqw($offset = 0, $length = null, $echoOnly = false) | |
{ | |
$dbq = DB::getQueryLog(); | |
foreach ($dbq as $key => $value) { | |
if (substr($value['query'], 0, 6) == 'select') | |
{ | |
unset($dbq[$key]); | |
} | |
} | |
s(array_slice($dbq, $offset, $length)); | |
if ($echoOnly == false) | |
{ | |
exit(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment